학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오)예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)예 [질문 내용] 여기에 질문 내용을 남겨주세요. h2.bat실행시 아무창도 뜨질 않습니다. 아예 반응이 없습니다. 열심히 구글링하여서 3시간가량 할 수 있는 방법을 동원해보았는데 해결이 되지 않아서 질문남깁니다 ㅜㅜ h2 버전은 강의에서 말씀하신 1.4.200 버전으로 다운로드 받았습니다 아래 해본 방법들을 남깁니다. 모두 결과는 실행하였을 때 반응이 없었습니다. [해본 방법들] cmd창에서 h2.bat 실행 , cmd창에서 "h2.bat" 실행 cmd창에서 h2.sh 실행, cmd창에서 " h2.sh " 실행 cmd창에서 h2w.bat 실행, cmd창에서 "h2w.bat" 실행 다운로드받은 경로 들어가서 마우스로 h2.bat 실행 cmd를 관리자권한으로 실행하여 1,2번 방법 h2파일 재설치 후 1,2,3,4,5 방법 노트북 재부팅 후 1,2,3,4,5 방법 프로젝트 폴더 안에있는 application.properties 파일에서 h2데이터베이스 연동설정(이건 아닌것같지만 혹시나해서해봤습니다.) h2포트번호 확인 후 cmd에서 포트번호 전부 확인해봤지만 사용중인 포트번호가 없어서 h2포트번호를 그냥 바꿔본 후 실행 환경변수 재설정 열심히 검색중에 하단 링크를 보았는데 해결방법을 못찾으신건가요 ㅠ 답변부탁드립니다!! 만약 해결방법이 없다면 Oracle을 연동하여 사용해보겠습니다. 최대한 강의와 비슷하게 진행하고 싶어서 꼭 해결할 수 있었으면 좋겠네요 https://www.inflearn.com/questions/175580
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 몇 주 있다가 다시 해보려니까 갑자기 모든 스프링이 에러가 뜨고 안됩니다.. 혹시 이유아실까요
이렇게 JPA와 JdbcTemplate을 함께 사용할 경우 JPA의 플러시 타이밍에 주의해야 한다. JPA는 데이터를 변경하면 변경 사항을 즉시 데이터베이스에 반영하지 않는다. 기본적으로 트랜잭션이 커밋되는 시점에 변경 사항을 데이터베이스에 반영한다. 그래서 하나의 트랜잭션 안에서 JPA를 통해 데이터를 변경한 다음에 JdbcTemplate을 호출하는 경우 JdbcTemplate에서는 JPA가 변경한 데이터를 읽기 못하는 문제가 발생한다. 이 문제를 해결하려면 JPA 호출이 끝난 시점에 JPA가 제공하는 플러시라는 기능을 사용해서 JPA의 변경 내역을 데이터베이스에 반영해주어야 한다. 그래야 그 다음에 호출되는 JdbcTemplate에서 JPA가 반영한 데이터를 사용할 수 있다. ================================ 같은 하나의 트랜젝션인데 변경한 다음에 JdbcTemplate을 호출하는 경우 JdbcTemplate에서는 JPA가 변경한 데이터를 읽기 못하는 문제가 발생한다. -- 이 이유가 데이터를 커밋하지않고 1차 캐쉬에만 변경 한 값을 가지고 있으니까 jdbc 템플릿은 변경 한값을 알 수 없어서 생기는 문제라고 생각하면 되는건가요 ?
[질문 내용] cmd창에 gradlew build를 치면 C:\Study\hello-spring>gradlew build > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > invalid source release: 11 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 1s 1 actionable task: 1 executed 이 에러가 뜨는데 어떻게 해결할 수 있을까요ㅜ
안녕하세요~! 간단한 질문이 있습니다! 혹시 그러면 Proxy 를 사용하게 되면 Bean Container 에는 진짜 MyLogger.class 가 등록될 일은 없는 걸까요? Proxy 를 사용하지 않으면 Request 가 들어오면 어쨌든 잠깐이라도 Bean Container 에 등록이 되었다가 폐기 되는 것으로 이해 했었습니다. 하지만 Proxy 를 사용하면 가짜 Porxy My Logger 가 싱글톤처럼 Bean 등록이 되고, 필요시 호출될 때마다 진짜 My Logger 를 사용하려는 클래스에 넘겨주게 되는 것이 맞을까요? (관리 객체는 클라이언트 객체: Controller, Service ).
실전! 코틀린과 스프링 부트로 도서관리 애플리케이션 개발하기 (Java 프로젝트 리팩토링)
안녕하세요. 12강 에서 처럼 Book.java를 Book.kt kotlin 코드로 변경하고 나서 테스트코드 수행하면 아래와 같은 오류가 발생합니다. 확인해야 될 사항이 뭐가 있을까요. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookRepository' defined in com.group.libraryapp.domain.book.BookRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class com.group.librayapp.domain.book.Book
Requirements static/node_module로 package.json에 선언된 의존성을 다운로드 받아야한다 gradle build 시 package.json에 선언된 의존성을 확인하고 다시 다운로드 받아야 한다. 뭔가 간단하게 끝내고 싶다 !!! Action https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md 다양한 관련 플러그인 들이 있지만, 위의 플러그인을 설치 했습니다. 2번의 요구사항은 gradle의 증분 컴파일(?)이 해주는 것 같습니다. (정확하지 않음 추측이에요) 3번은 관련 자료를 찾던 도중 processResources 를 발견했고, Copies production resources into the production resources directory. 라고 설명 되어 있습니다.(공식 홈페이지) 따라서, npm install 시 node_module 파일을 static 이하로 떨어 뜨리면 되겠구나! 그리고 processResources를 "npm install 동작을하는 " Task를 의존하게 하면 되겠구나! -- 주석이 많아 가독성이 떨어지지만, 한번 읽어보시면 더 도움이 될거라 생각해서 위의 깃헙에 있는 주석 그대로 복사 붙여넣기 합니다. 수정한 부분은 nodeProjectDir 부분과processResources.dependsOn 부분 입니다. 추가로 package.json 도 아래분이 잘 정리 해주셔서 함께 복사 붙여넣기 합니다.(고맙습니다!!) -인텔리제이 빌드시(gradle로 설정안했을 경우 동작안해요!) -gradle 탭 누르셔서 npm Task 들어오는지 확인해주세요! { "name": "static", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "@yaireo/tagify": "^3.5.1", "bootstrap": "^4.4.1", "cropper": "^4.1.0", "font-awesome": "^4.7.0", "jdenticon": "^2.2.0", "jquery": "^3.4.1", "jquery-cropper": "^1.0.1", "mark.js": "^8.11.1", "moment": "^2.24.0", "summernote": "^0.8.16" } } plugins { id "com.github.node-gradle.node" version "3.5.0" id 'org.springframework.boot' version '2.7.5' id 'io.spring.dependency-management' version '1.0.15.RELEASE' id 'java' } group = 'me.studyOlle' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } node { // Whether to download and install a specific Node.js version or not // If false, it will use the globally installed Node.js // If true, it will download node using above parameters // Note that npm is bundled with Node.js download = true // Version of node to download and install (only used if download is true) // It will be unpacked in the workDir version = "16.14.0" // Version of npm to use // If specified, installs it in the npmWorkDir // If empty, the plugin will use the npm command bundled with Node.js npmVersion = "" // Version of Yarn to use // Any Yarn task first installs Yarn in the yarnWorkDir // It uses the specified version if defined and the latest version otherwise (by default) yarnVersion = "" // Base URL for fetching node distributions // Only used if download is true // Change it if you want to use a mirror // Or set to null if you want to add the repository on your own. distBaseUrl = "https://nodejs.org/dist" // Specifies whether it is acceptable to communicate with the Node.js repository over an insecure HTTP connection. // Only used if download is true // Change it to true if you use a mirror that uses HTTP rather than HTTPS // Or set to null if you want to use Gradle's default behaviour. allowInsecureProtocol = null // The npm command executed by the npmInstall task // By default it is install but it can be changed to ci npmInstallCommand = "install" // The directory where Node.js is unpacked (when download is true) workDir = file("${project.projectDir}/.gradle/nodejs") // The directory where npm is installed (when a specific version is defined) npmWorkDir = file("${project.projectDir}/.gradle/npm") // The directory where yarn is installed (when a Yarn task is used) yarnWorkDir = file("${project.projectDir}/.gradle/yarn") // The Node.js project directory location // This is where the package.json file and node_modules directory are located // By default it is at the root of the current project nodeProjectDir = file("${project.projectDir}/src/main/resources/static") // Whether the plugin automatically should add the proxy configuration to npm and yarn commands // according the proxy configuration defined for Gradle // Disable this option if you want to configure the proxy for npm or yarn on your own // (in the .npmrc file for instance) nodeProxySettings = ProxySettings.SMART } dependencies { // View Template Engine implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' // Security implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' //Web implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-web' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.5' //Persistence implementation 'org.springframework.boot:spring-boot-starter-data-jpa' runtimeOnly 'com.h2database:h2' runtimeOnly 'com.mysql:mysql-connector-j' // LomBok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' // Dev developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' //Test Implementation testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' } tasks.named('test') { useJUnitPlatform() } processResources.dependsOn('npmInstall')
[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 스프링 컨테이너에있는 스프링 빈을 찾아올때, getBean() 메서드를 통해 찾을수있다고 이해했는데요. 메서드를 호출할때 getBean(이름, 타입) 의 형식으로 사용한다고 되어있는데 1. 여기서 타입은 어떤 타입을 파라미터로 넣어줘야하는건가요? 예를들면 MemberService memberService = applicationContext.getBean("memberService", MemberService.class); 로 사용할수도있고, MemberServiceImpl memberService = applicationContext.getBean("memberService", MemberServiceImpl.class); 로 사용할수도있는데, 어떤 타입을 파라미터로 넣어줘야하는건지 궁금합니다. 스프링빈의 타입인 객체타입(MemberServiceImpl)을 넣어줄수도있고, AppConfig 클래스에있는 memberService메서드의 리턴타입(MemberService) 을 넣어줄수도있는건가요? 일반메소드의 리턴타입처럼 getBean()을 통해서 얻은 객체를 어떤타입으로 받고자한다를 클래스타입으로 적어줘야하는건가요? 2. 그리고 타입을 파라미터로 넣어줄때 .class를 쓰는 이유가 궁급합니다. 예를들면 MemberService의 경우에는 인터페이스라서 MemberService.interface형식으로 넣어줘야할거같은데 .class를 붙여서 넣어주는 이유가 궁급합니다. 3. 1,2번의 질문들을 생각하면서 정리해봤는데, 타입부분에서 파라미터로 넘겨준 MemberService.class는 클래스타입=메서드의 리턴타입 = 역할타입 = 인터페이스타입 이고, MemberServiceImpl.class는 구체타입=객체타입=스프링빈타입이다. 이렇게 정리해봤는데 맞는건가요? 구글링도해보고, 게시판에 비슷한 글이 있나 찾아보기도 했는데 원하는 답변이 없어서 질문드립니다..
18:15 듣다가 질문이 생겼습니다(@commit 를 붙여야 업데이트 쿼리가 나간다.) 우선 @트랜잭션을 맨위 상단에 선언 했다고 하고 69~84 라인은 전체 하나의 단위 트랜잭션이고 이 안에서 또 71~73 라인은 하나의 트랜잭션단위 76~77 라인은 또다른 하나의 트랜잭션 단위 80은 또 다른 하나의 트랜잭션 단위 이렇게 생각하는게 맞나요 ?
ParentInterface parentInterface = (ParentInterface)Proxy.newProxyInstance(HelloApplication.class.getClassLoader(), new Class[]{ParentInterface.class}, (proxy, method, args) -> { System.out.println("메소드 수행전에 할일"); Object methodResult = method.invoke(new ChildClass(), args);//child라는 class에 args를 모두 넘긴다 if(method.getName() == "sayHello"){//메서드 이름에 따라.. 처리를 분류할 수 있으니 다 정의하지 않아도됨 모든 메서드에 대해 기본적으로 정의되는거니까 중복도 피할 수 있음 System.out.println("sayHello!"); return methodResult; } System.out.println("sayOne!"); return methodResult; }); parentInterface.sayHello(); //클라이언트는 인터페이스타입에 대해 그 메서드를 호출한다 이 인터페이스에 대한 메서드를 호출하면 위에서 정의한대로 프록스 객체를 런타임에 하나 만들어줘서 //위에서 정의한 대로의 로직을 타고 클라이언트에게 결과를 전송해준다 parentInterface.sayOne(); 지금 인터페이스에 대한 .class정보를 넘겨주고 있어요 그리고 Proxy.newProxyInstance메서드로 들어가보면 넘겨준 class정보를 가지고 생성자를 만든다거나 하는것같거든요 그런거 자체가 리플렉션을 활용하는 행위인가요? (class이름).class <- 이표현자체는 리플렉션을 활용하는 문장인가요? cglib, 바이트 버디는 리플렉션을 사용하지 않나요?
지금 강의는 mem:test:db 이건 스프링부트가 만들어주는 스키마이고, (메모리로동작?) 이전 강의는 testcase 라는 스키마를 저희가 직접만들었고 이 차이 인건가요 ?!? =========================== 둘중 어느방식으로 테스트코드를 더 많이 사용하나요 ? 눈으로 직접 테이블을 보고싶다면 저희가 먼저 이용한 testcase 방식을 사용하면 되는건가요 ?