묻고 답해요
169만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
35강 책 대출/반납 기능 리팩토링과 지연로딩 적용 후의 문제
안녕하세요 공부하는 개발자 최태현님!재미있게 강의 듣던 중 질문 드릴 부분이 있어 또 찾아오게 되었네요 ㅎㅎ이번에는 '35강 책 대출/반납 기능 리팩토링과 지연로딩' 적용 후의 문제 에 대해서 질문 남겨보겠습니다!user_loan_history의 대출 / 반납 시,대출(book_name : java / user_id : 22)반납 (book_name : java / user_id : 22)위와 같이 '처음' 한번의 '대출과 반납' 에는 문제가 없으나,아래와 같이 '이미' '대출과 반납'이 진행되었던 [id: 7 / book_name : java] 를 가지고 '대출과 반납 을 '다시' 진행해보면,,대출이 된 상태(is_return : 0)는 정상적으로 유지가 됩니다. (대출 시도 시, 이미 이미 대출된 책이라는 에러 메시지 정상 출력) 반면 반납의 경우, 브라우저 alter창에서는 반납 되었다고 뜨지만 DB에서는 정상적으로 적용되지 않네요., ㅠㅠ (브라우저통해 반납 시도 시, 무한 성공 but DB 미적용 )(위 이미지 상의 '일기'라는 책은 검증용으로 '대출과 반납'을 단 1회만 해둔 상태)추가 테스트 (history 데이터 삭제 후 진행)책 반납 시, 해당 책에 관한 데이터가 user_loan_history에서 기록이 삭제 되도록 따로 구현이 필요한 부분일까요..??(강의에 있는데 제가 놓친 부분이라면 죄송합니다..!!)그럼, 오늘 하루도 잘 마무리 하시고 행복한 밤 되시길 바라며이번에도 미리 답변 감사드리며 배포 진행하고 있을게요!행복하세요 감사합니다!
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
DispatcherType=ERROR 에 대한 질문입니다.
=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) 예[질문 내용]/error-ex/{statusCode} 로 파라미터를 받아 다양한sendError(statusCode)를 시도해보는 중에 궁금한 점이 생겼습니다.현재 ErrorPage에는 404, 500, RuntimeException이 등록되어 있습니다. 첫 요청의 DispatcherType이 REQUEST로 들어오고WAS -> 필터 -> ... -> 컨트롤러 -> send(등록안된코드)WAS에서 505에 해당하는 ErrorPage 탐색등록된 것이 없어 뭔가 기본값인 "/error"로 DispatcherType=ERROR 요청을 보내는 것 같습니다.이후, TemplateInputException이 발생합니다."/error" 컨트롤러가 [error] 뷰를 리턴하는데 해당하는 템플릿이 없다는 내용 같습니다.여기서의 질문입니다.제가 이해하기로는 이 예외가 다시 WAS로 올라가서,위 과정 중 2번을 수행해야할 것 같습니다.WAS는 등록된 ErrorPage 중 RuntimeException에 해당하는 컨트롤러로 다시 DispatcherType=ERROR 요청을 해야할 것 같은데그러한 과정 없이 예외가 터지고 끝인 것 같습니다.톰캣에서 특정 Exception은 알아서 처리하고 끝내는걸까요?
-
해결됨스프링 DB 1편 - 데이터 접근 핵심 원리
리소스 반환순서
Connection이 PreparedStatement의 전제조건이므로, Connection을 반환하면 PreparedStatement 은 자동반환되지 않는 것인가요? 감사합니다.
-
미해결스프링 DB 1편 - 데이터 접근 핵심 원리
throw 예외
안녕하세요 좋은 강의 항상 감사합니다.6:35에 31라인에서굳이 catch 로 잡은 SQLException을 왜 굳이 밖으로 throw e 하는 이유가 있을까요? 감사합니다.
-
해결됨스프링 DB 1편 - 데이터 접근 핵심 원리
static 함수
안녕하세요 좋은 강의 항상 감사합니다. 강의에서 DBConnectionUtil 클래스에서 Connection 을 반환하는 getConnection() 함수를 static 으로 만든 이유가 있을까요? 친절한 답변 미리 감사드립니다.
-
해결됨토비의 스프링 부트 - 이해와 원리
질문드립니다.
안녕하세여 초보적인 질문드려서 죄송합니다..Configuration ProxyBeanMethods 값을 false 를 주면 호출 할때마다 새로운 객체를 생성하게 되는데.. 다시 말해 싱글톤임을 보장 받을수 없게 되는걸로 이해하였습니다. 아마 false주는 경우는 없을듯합니다만 혹시 사례가 있을까요?'굳이' 라는 말을 강의에서 계속 하셔서 사례라고 하면 생각해봤을때 싱글톤의 단점인것을 보안하기 위해 사용되는건지? 아니면 성능적인것 때문에 그런지 궁금합니다.마지막 내용에 spring 에 실제 사용된 내용으로 봤을떈, 단순한 Configuration 일땐 false를 주면 될듯한데. 디테일한 사례가 궁금합니다. 감사합니다.
-
미해결스프링 핵심 원리 - 기본편
수동, 자동빈 중복 등록 시 테스트코드에선 오류가 나지 않는 이유
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]수동빈과 자동빈을 중복 등록할 때 테스트코드에서는 에러가 뜨지 않았지만 CoreApplication을 실행시켰을 때는 에러가 납니다. 선생님께서 이는 스프링부트를 사용했을 때 에러가 나게 해주기 때문이라고 하셨었는데, 그렇다면 테스트코드의 Junit에서는 스프링부트가 아닌 스프링을 사용했기 때문에 에러가 나지 않은 건가요? 저희가 스프링부트 환경에서 코드를 작성하고 있는데 Junit에서만 스프링을 쓰는게 가능한가요?
-
해결됨스프링 DB 2편 - 데이터 접근 활용 기술
TxBasicTest 오류
"C:\Program Files\Java\jdk-18\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\lib\idea_rt.jar=12660:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\Mathlife\.m2\repository\org\junit\platform\junit-platform-launcher\1.9.2\junit-platform-launcher-1.9.2.jar;C:\Users\Mathlife\.m2\repository\org\junit\platform\junit-platform-engine\1.9.2\junit-platform-engine-1.9.2.jar;C:\Users\Mathlife\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Mathlife\.m2\repository\org\junit\platform\junit-platform-commons\1.9.2\junit-platform-commons-1.9.2.jar;C:\Users\Mathlife\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\plugins\junit\lib\junit-rt.jar;C:\Users\Mathlife\Desktop\Backend\06. spring-db-2\source\springtx\out\test\classes;C:\Users\Mathlife\Desktop\Backend\06. spring-db-2\source\springtx\out\production\classes;C:\Users\Mathlife\Desktop\Backend\06. spring-db-2\source\springtx\out\production\resources;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\3.0.3\d302964840ffeef5098ec7ae1384c97b590e6a50\spring-boot-starter-data-jpa-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.projectlombok\lombok\1.18.26\8f8cf0372abf564913e9796623aac4c8ea44025a\lombok-1.18.26.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-test\3.0.3\41c1983addad955bf3d4b923ac7ed1775c6d26d6\spring-boot-starter-test-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\3.0.3\b7bfb96b95e60ebe8d345eb6f2c872557a682ace\spring-boot-starter-aop-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\3.0.3\d0629ac327da8bb19d7327230956150b8781fe94\spring-boot-starter-jdbc-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.hibernate.orm\hibernate-core\6.1.7.Final\343f47b34c96fe9c44bf9b219a7b3c5d6d2fc90e\hibernate-core-6.1.7.Final.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\3.0.2\ffb79a3370ebf09a63ac5f7aa8d85f4e339a47e4\spring-data-jpa-3.0.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\6.0.5\a758bb59124425df6614c4d335365c1a2bdbeafa\spring-aspects-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\3.0.3\bf77d1a59e933f31b99acc437206ee3aabcc421e\spring-boot-starter-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test-autoconfigure\3.0.3\d30f322cc3a4b653b9b0fb48ea24c4c59f6531a4\spring-boot-test-autoconfigure-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test\3.0.3\96b00d9edd18b57a27089c3702f3fcc138817\spring-boot-test-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.jayway.jsonpath\json-path\2.7.0\f9d7d9659f2694e61142046ff8a216c047f263e8\json-path-2.7.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\4.0.0\bbb399208d288b15ec101fa4fcfc4bd77cedc97a\jakarta.xml.bind-api-4.0.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.assertj\assertj-core\3.23.1\d2bb60570f5b3d7ffa8f8000118c9c07b86eca93\assertj-core-3.23.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest\2.2\1820c0968dba3a11a1b30669bb1f01978a91dedc\hamcrest-2.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter\5.9.2\26c586fbe0ebd81b48c9f11f0d998124248697ae\junit-jupiter-5.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.mockito\mockito-junit-jupiter\4.8.1\e393aa62eca2244a535b03842843f2f199343d1f\mockito-junit-jupiter-4.8.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.mockito\mockito-core\4.8.1\d8eb9dec8747d08645347bb8c69088ac83197975\mockito-core-4.8.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.skyscreamer\jsonassert\1.5.1\6d842d0faf4cf6725c509a5e5347d319ee0431c3\jsonassert-1.5.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-test\6.0.5\8be22c21ccbfdfc9651e205559ad11c4063373e9\spring-test-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\6.0.5\257932031f676dae20989046630dd5deed6a80cb\spring-core-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.xmlunit\xmlunit-core\2.9.1\e5833662d9a1279a37da3ef6f62a1da29fcd68c4\xmlunit-core-2.9.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\6.0.5\ac13a58d1ccc0619709572a05f067cc81741d7d3\spring-aop-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.19\afbffb1210239fbba5cad73093c5b216d515838f\aspectjweaver-1.9.19.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\6.0.5\7555dec3648ffb656fb36a902cf9a74c5db7c392\spring-jdbc-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\5.0.1\a74c7f0a37046846e88d54f7cb6ea6d565c65f9c\HikariCP-5.0.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\3.1.0\66901fa1c373c6aff65c13791cc11da72060a8d6\jakarta.persistence-api-3.1.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\2.0.1\51a520e3fae406abb84e2e1148e6746ce3f80a1a\jakarta.transaction-api-2.0.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\6.0.5\468e6a8446072a9eea95ff17bf5f03c97414cdf3\spring-context-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\6.0.5\82e5d0afe235807b25e92c7bf5054bcd7206f34d\spring-orm-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\3.0.2\ef6fe3b62d6f5582d97d5eb402fc474def8e7d7b\spring-data-commons-3.0.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\6.0.5\92127c0a17c63f70320d20b05d56e21acd6ffbbf\spring-tx-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\6.0.5\2ab5549926db09a63786c8073a79d686ea15264c\spring-beans-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\2.1.1\48b9bda22b091b1f48b13af03fe36db3be6e1ae3\jakarta.annotation-api-2.1.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\2.0.6\88c40d8b4f33326f19a7d3c0aaf2c7e8721d4953\slf4j-api-2.0.6.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\3.0.3\17a64795795ecf1f1f6f0cc1c2794e2bed23ceda\spring-boot-autoconfigure-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\3.0.3\d781e7afbeb3d05ce361e9cc4fa7d38b15fb3862\spring-boot-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\3.0.3\df4efe00271856a50f2e65abce2ddf4e5a529a25\spring-boot-starter-logging-3.0.3.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.33\2cd0a87ff7df953f810c344bdf2fe3340b954c69\snakeyaml-1.33.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\net.minidev\json-smart\2.4.8\7c62f5f72ab05eb54d40e2abf0360a2fe9ea477f\json-smart-2.4.8.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\2.1.1\88c774ab863a21fb2fc4219af95379fafe499a31\jakarta.activation-api-2.1.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.12.23\d470526e8c4566c04e9ae5d3ccb62d1a7aa58986\byte-buddy-1.12.23.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-params\5.9.2\bc2765afb7b85b583c710dd259a11c6b8c39e912\junit-jupiter-params-5.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-api\5.9.2\fed843581520eac594bc36bb4b0f55e7b947dda9\junit-jupiter-api-5.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.12.23\1cba11fdb72c383edacb909f79ae6870efd275e4\byte-buddy-agent-1.12.23.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.vaadin.external.google\android-json\0.0.20131108.vaadin1\fa26d351fe62a6a17f5cda1287c1c6110dec413f\android-json-0.0.20131108.vaadin1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\6.0.5\69b78d3e84b8f66d679447225322fac3b8137ff0\spring-jcl-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\6.0.5\7fcdf1cc183667b43583dca92d9345d27e43f040\spring-expression-6.0.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.4.5\28e7dc0b208d6c3f15beefd73976e064b4ecfa9b\logback-classic-1.4.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.19.0\30f4812e43172ecca5041da2cb6b965cc4777c19\log4j-to-slf4j-2.19.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\2.0.6\c4d348977a83a0bfcf42fd6fd1fee6e7904f1a0c\jul-to-slf4j-2.0.6.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\net.minidev\accessors-smart\2.4.8\6e1bee5a530caba91893604d6ab41d0edcecca9a\accessors-smart-2.4.8.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.apiguardian\apiguardian-api\1.1.2\a231e0d844d2721b0fa1b238006d15c6ded6842a\apiguardian-api-1.1.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.9.2\6f9f8621d8230cd38aa42e58ccbc0c00569131ce\junit-platform-commons-1.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.2.0\28c11eb91f9b6d8e200631d46e20a7f407f2a046\opentest4j-1.2.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.4.5\e9bb2ea70f84401314da4300343b0a246c8954da\logback-core-1.4.5.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.19.0\ea1b37f38c327596b216542bc636cfdc0b8036fa\log4j-api-2.19.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm\9.1\a99500cf6eea30535eeac6be73899d048f8d12a8\asm-9.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.h2database\h2\2.1.214\d5c2005c9e3279201e12d4776c948578b16bf8b2\h2-2.1.214.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\4.0.2\e4e4e0c5b0d42054d00dc4023901572a60d368c7\jaxb-runtime-4.0.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.5.0.Final\c19307cc11f28f5e2679347e633a3294d865334d\jboss-logging-3.5.0.Final.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\6.0.6.Final\77a5f94b56d49508e0ee334751db5b78e5ccd50c\hibernate-commons-annotations-6.0.6.Final.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.jboss\jandex\2.4.2.Final\1e1c385990b258ff1a24c801e84aebbacf70eb39\jandex-2.4.2.Final.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\jakarta.inject\jakarta.inject-api\2.0.0\46fc8560b6fd17b78396d88f39c1a730457671f0\jakarta.inject-api-2.0.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.antlr\antlr4-runtime\4.10.1\10839f875928f59c622d675091d51a43ea0dc5f7\antlr4-runtime-4.10.1.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-engine\5.9.2\572f7a553b53f83ee59cc045ce1c3772864ab76c\junit-jupiter-engine-5.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.objenesis\objenesis\3.2\7fadf57620c8b8abdf7519533e5527367cb51f09\objenesis-3.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-core\4.0.2\8c29249f6c10f4ee08967783831580b0f5c5360\jaxb-core-4.0.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.9.2\40aeef2be7b04f96bb91e8b054affc28b7c7c935\junit-platform-engine-1.9.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.eclipse.angus\angus-activation\2.0.0\72369f4e2314d38de2dcbb277141ef0226f73151\angus-activation-2.0.0.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\4.0.2\24e167be69c29ebb7ee0a3b1f9b546f1dfd111fc\txw2-4.0.2.jar;C:\Users\Mathlife\.gradle\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\4.1.1\9b3769c76235bc283b060da4fae2318c6d53f07e\istack-commons-runtime-4.1.1.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 hello.springtx.apply.TxBasicTest 14:42:46.190 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [TxBasicTest]: using SpringBootContextLoader 14:42:46.192 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [hello.springtx.apply.TxBasicTest]: no resource found for suffixes {-context.xml, Context.groovy}. 14:42:46.210 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using ContextCustomizers for test class [TxBasicTest]: [DisableObservabilityContextCustomizer, PropertyMappingContextCustomizer, Customizer, ExcludeFilterContextCustomizer, DuplicateJsonObjectContextCustomizer, MockitoContextCustomizer, TestRestTemplateContextCustomizer] 14:42:46.300 [main] DEBUG org.springframework.test.context.util.TestContextSpringFactoriesUtils - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing dependency. Specify custom TestExecutionListener classes or make the default TestExecutionListener classes and their required dependencies available. Offending class: [jakarta/servlet/ServletContext] 14:42:46.309 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners for test class [TxBasicTest]: [DirtiesContextBeforeModesTestExecutionListener, ApplicationEventsTestExecutionListener, MockitoTestExecutionListener, DependencyInjectionTestExecutionListener, DirtiesContextTestExecutionListener, TransactionalTestExecutionListener, SqlScriptsTestExecutionListener, EventPublishingTestExecutionListener, RestDocsTestExecutionListener, MockRestServiceServerResetTestExecutionListener, MockMvcPrintOnlyOnFailureTestExecutionListener, WebDriverTestExecutionListener, MockWebServiceServerTestExecutionListener, ResetMocksTestExecutionListener] 14:42:46.310 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: class [TxBasicTest], class annotated with @DirtiesContext [false] with mode [null] 14:42:46.319 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test class hello.springtx.apply.TxBasicTest . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.0.3) 2023-03-01T14:42:46.513+09:00 INFO 10348 --- [ main] hello.springtx.apply.TxBasicTest : Starting TxBasicTest using Java 18 with PID 10348 (started by Mathlife in C:\Users\Mathlife\Desktop\Backend\06. spring-db-2\source\springtx) 2023-03-01T14:42:46.514+09:00 INFO 10348 --- [ main] hello.springtx.apply.TxBasicTest : No active profile set, falling back to 1 default profile: "default" 2023-03-01T14:42:46.750+09:00 INFO 10348 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2023-03-01T14:42:46.763+09:00 INFO 10348 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8 ms. Found 0 JPA repository interfaces. 2023-03-01T14:42:47.004+09:00 INFO 10348 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2023-03-01T14:42:47.143+09:00 INFO 10348 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:a14918b4-a6d6-4daf-8c5f-4f7baf9d1b32 user=SA 2023-03-01T14:42:47.144+09:00 INFO 10348 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2023-03-01T14:42:47.176+09:00 INFO 10348 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2023-03-01T14:42:47.214+09:00 INFO 10348 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.1.7.Final 2023-03-01T14:42:47.440+09:00 INFO 10348 --- [ main] SQL dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2023-03-01T14:42:47.620+09:00 INFO 10348 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2023-03-01T14:42:47.628+09:00 INFO 10348 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2023-03-01T14:42:47.718+09:00 INFO 10348 --- [ main] hello.springtx.apply.TxBasicTest : Started TxBasicTest in 1.374 seconds (process running for 1.964) 2023-03-01T14:42:47.722+09:00 ERROR 10348 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener] to prepare test instance [hello.springtx.apply.TxBasicTest@615e83ac] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hello.springtx.apply.TxBasicTest': Unsatisfied dependency expressed through field 'basicService': No qualifying bean of type 'hello.springtx.apply.TxBasicTest$BasicService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:712) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:692) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:133) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:481) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1398) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:398) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:142) ~[spring-test-6.0.5.jar:6.0.5] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:97) ~[spring-test-6.0.5.jar:6.0.5] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241) ~[spring-test-6.0.5.jar:6.0.5] at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) ~[spring-test-6.0.5.jar:6.0.5] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na] at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310) ~[na:na] at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) ~[na:na] at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) ~[na:na] at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:376) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:289) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:288) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at java.base/java.util.Optional.orElseGet(Optional.java:364) ~[na:na] at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68) ~[junit-jupiter-engine-5.9.2.jar:5.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90) ~[junit-platform-engine-1.9.2.jar:1.9.2] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na] at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.2.jar:1.9.2] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na] at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) ~[junit-platform-engine-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) ~[junit-platform-launcher-1.9.2.jar:1.9.2] at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) ~[junit5-rt.jar:na] at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) ~[junit-rt.jar:na] at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) ~[idea_rt.jar:na] at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) ~[junit-rt.jar:na] at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) ~[junit-rt.jar:na] at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) ~[junit-rt.jar:na] Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'hello.springtx.apply.TxBasicTest$BasicService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1812) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1371) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[spring-beans-6.0.5.jar:6.0.5] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:709) ~[spring-beans-6.0.5.jar:6.0.5] ... 76 common frames omitted org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hello.springtx.apply.TxBasicTest': Unsatisfied dependency expressed through field 'basicService': No qualifying bean of type 'hello.springtx.apply.TxBasicTest$BasicService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:712) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:692) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:133) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:481) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1398) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:398) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:142) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:97) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$10(ClassBasedTestDescriptor.java:377) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:382) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$11(ClassBasedTestDescriptor.java:377) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310) at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735) at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:376) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:289) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:288) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:278) at java.base/java.util.Optional.orElseGet(Optional.java:364) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:277) at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:105) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:104) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57) at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'hello.springtx.apply.TxBasicTest$BasicService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1812) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1371) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:709) ... 76 more 2023-03-01T14:42:47.739+09:00 INFO 10348 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2023-03-01T14:42:47.741+09:00 INFO 10348 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2023-03-01T14:42:47.742+09:00 INFO 10348 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. Process finished with exit code -1 TxBasicTest를 실행하면 위와 같은 에러가 발생합니다.스프링 부트 버전과 자바 버전을 제외한 다른 부분은 똑같이 설정한 것 같은데 뭐가 문제인지를 모르겠습니다. build.gradleplugins { id 'java' id 'org.springframework.boot' version '3.0.3' id 'io.spring.dependency-management' version '1.1.0' } group = 'hello' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' //테스트에서 lombok 사용 testCompileOnly 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' } tasks.named('test') { useJUnitPlatform() } 디렉토리 구조테스트 코드package hello.springtx.apply; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronizationManager; import static org.assertj.core.api.Assertions.*; @Slf4j @SpringBootTest public class TxBasicTest { @Autowired BasicService basicService; @Test void proxyCheck() { log.info("aop class={}", basicService.getClass()); assertThat(AopUtils.isAopProxy(basicService)).isTrue(); } @Test void txTest() { basicService.tx(); basicService.nonTx(); } @TestConfiguration static class TxApplyBasicConfig { @Bean BasicService basicService() { return new BasicService(); } } @Slf4j static class BasicService { @Transactional public void tx() { boolean txActive = TransactionSynchronizationManager.isActualTransactionActive(); log.info("call tx"); log.info("tx active={}", txActive); } public void nonTx() { boolean txActive = TransactionSynchronizationManager.isActualTransactionActive(); log.info("call non tx"); log.info("tx active={}", txActive); } } }
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
질문 드립니다
안녕하세요 선생님.JdbcTemplate이 있기 때문에 UserController가 인스턴스화되지 않아도 실행된다고 하셨는데 CalculatorController에 JdbcTemplate이 없는데 어떻게 실행되는 건가요?답변 감사드립니다.
-
해결됨스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
viewResolve 실행되는 위치가 render() 안에 있는게 맞나요?
PDF를 보면서 복습을 하는데1. 핸들러어댑터호출핸들러어댑터를 통해 new-form 이라는 논리뷰 이름을 획득한다.2. ViewResolver 호출new-form 이라는뷰 이름으로 viewResolver를 순서대로호출한다.BeanNameViewResolver 는 new-form 이라는 이름의스프링 빈으로등록된 뷰를찾아야하는데 없다. InternalResourceViewResolver 가 호출된다.3. InternalResourceViewResolver이뷰 리졸버는 InternalResourceView 를반환한다.4. 뷰 - InternalResourceViewInternalResourceView 는 JSP처럼포워드 forward() 를호출해서 처리할수 있는경우에 사용한다.5. view.render()view.render() 가호출되고 InternalResourceView 는 forward() 를사용해서 JSP를실행한다.그런데 코드를 찾아보니까render()가 실행되면서 resolveViewName()로 viewResolver를 순회하던데이때 InternalResourceViewResolver가 호출되는게 맞나요 ?
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
ItemType[] 과 List<DeliveryCode> 의 차이
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]@ModelAttribute() 에서 regions() 는 map을 사용했고itemTpyes()는 배열을 사용했고deliveryCodes()는 리스트를 사용하셨는데 각각을 이렇게 사용하신 이유가 따로 있을까요??
-
해결됨스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
인터셉터 활용 방법 질문
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]안녕하세요. 좋은 강의 잘 듣고 있습니다. 감사합니다.다름이 아니라 제가 혼자서 토이프로젝트를 만드는중에 ADMIN / USER 권한을 분리하고 인터셉터를 통해서 권한이 없으면 /admin/**이 포함된 url에는 접근을 못하도록 코드를 구현했습니다. 포스트 맨으로 확인을 해 보았을 때, 실제로 권한이 없으면 원하는 값이 나오지 않지만 HTTP 상태코드가 200(OK)로 나옵니다. 제가 이해한게 맞다면, 인터셉터의 역할은 올바른 요청일 땐 정상 흐름으로 작동하고 잘못된 요청(return false;)일 땐 리다이렉트 처리해서 흐름을 바꿔주는(?) 것으로 알고 있습니다. 혹시 인터셉터를 통해서 상태코드도 변환할 수 있는 방법이 있는지 궁금합니다! 혹시 안된다면 다른 방법이 있는지도 궁금합니다!
-
해결됨스프링 부트 - 핵심 원리와 활용
Tomcat에 대해 질문드립니다.
안녕하세요. 강의를 보고 궁금한 점이 생겨 질문드립니다.Java 진영에서 말하는 WAS의 정의를 보면'웹 애플리케이션 서버는 대부분이 자바 기반으로 주로 자바 EE 표준을 수용하고 있으나, 자바 기반이지만 자바 EE 표준을 따르지 않는 제품과 .NET이나 Citrix 기반인 비 자바 계열도 존재한다' 라고 설명되어있습니다.Tomcat은 아파치 재단에서 만든 웹 컨테이너(서블릿 컨테이너)만 있는 WAS라고 설명하는데웹 컨테이너만 지원하는 Tomcat을 WAS라고 할 수 있는건지 궁금합니다.
-
해결됨스프링 시큐리티 OAuth2
Ajax 인증시 인가코드가 발급 되지 않는 원인 문의
Spring Authorization 1.0,1 기반으로 개발을 하고 있습니다. 인가코드를 발급 할떄 FormLogin 기본 설정을 사용하면 인가코드가 발급이 되는데 Ajax 로 로그인을 하면 인가코드가 발급되지 않고 있습니다. 디버깅을 해보면 로그인인 후 OAuth2AuthorizationEndpointFilter 는 실행되는데 @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { if (!this.authorizationEndpointMatcher.matches(request)) { filterChain.doFilter(request, response); return; } try { Authentication authentication = this.authenticationConverter.convert(request); if (authentication instanceof AbstractAuthenticationToken) { ((AbstractAuthenticationToken) authentication) .setDetails(this.authenticationDetailsSource.buildDetails(request)); } Authentication authenticationResult = this.authenticationManager.authenticate(authentication); if (!authenticationResult.isAuthenticated()) { // If the Principal (Resource Owner) is not authenticated then // pass through the chain with the expectation that the authentication process // will commence via AuthenticationEntryPoint filterChain.doFilter(request, response); return; } if (authenticationResult instanceof OAuth2AuthorizationConsentAuthenticationToken) { if (this.logger.isTraceEnabled()) { this.logger.trace("Authorization consent is required"); } sendAuthorizationConsent(request, response, (OAuth2AuthorizationCodeRequestAuthenticationToken) authentication, (OAuth2AuthorizationConsentAuthenticationToken) authenticationResult); return; } this.authenticationSuccessHandler.onAuthenticationSuccess( request, response, authenticationResult); } catch (OAuth2AuthenticationException ex) { if (this.logger.isTraceEnabled()) { this.logger.trace(LogMessage.format("Authorization request failed: %s", ex.getError()), ex); } this.authenticationFailureHandler.onAuthenticationFailure(request, response, ex); } } FormLogin 적용시에는 authenticationResult의 principal 에 UsernamePasswordAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되는데 AjaxLogin 적용시에는 authenticationResult의 principal 에 AnonymousAuthenticationToken이 설정되어 인가 코드가 정상적으로 발급되지 않고 403 예외가 발생합니다.AuthenticationProvider 구현체에서는 정상적으로 토큰을 저장하고 있습니다. AuthenticationProvider 구현체 소스@Component @RequiredArgsConstructor public class CustomAuthenticationProvider implements AuthenticationProvider { private final CustomUserDetailsService customUserDetailsService; private final PasswordEncoder passwordEncoder; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if(authentication == null){ throw new InternalAuthenticationServiceException("Authentication is null"); } LoginRequestDto loginRequestDto = (LoginRequestDto)authentication.getPrincipal(); String password = loginRequestDto.getLoginPassword(); UserAdapter userAdapter = (UserAdapter) customUserDetailsService.loadUserByLoinRequestDto(loginRequestDto); if (!passwordEncoder.matches(password, userAdapter.getCurrentUser().getLoginPwd())) { throw new BadCredentialsException("BadCredentialsException"); } CustomAuthenticationToken result = CustomAuthenticationToken.authenticated(userAdapter.getCurrentUser(), authentication.getCredentials(), userAdapter.getAuthorities()); result.setDetails(authentication.getDetails()); return result; } @Override public boolean supports(Class<?> authentication) { return CustomAuthenticationToken.class.isAssignableFrom(authentication); } } 이외 Custom 소스Spring Security 설정@EnableWebSecurity @RequiredArgsConstructor @Configuration public class DefaultSecurityConfig { private final CustomAuthenticationProvider customAuthenticationProvider; // private final CustomUserDetailsService customUserDetailsService; @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } @Bean public CustomAuthenticationProcessingFilter customAuthenticationProcessingFilter() throws Exception { CustomAuthenticationProcessingFilter filter = new CustomAuthenticationProcessingFilter(); // filter.setAuthenticationManager(authenticationManager(null)); filter.setAuthenticationManager(new ProviderManager(customAuthenticationProvider)); // filter.setAuthenticationSuccessHandler(customAuthenticationSuccessHandler()); // filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler()); return filter; } // @formatter:off @Bean SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authorizeRequests ->authorizeRequests .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() .requestMatchers(new AntPathRequestMatcher("/")).permitAll() .requestMatchers(new AntPathRequestMatcher("/login/**")).permitAll() .requestMatchers("/api/login/**").permitAll() .requestMatchers("/api/registered-client/**").permitAll() .anyRequest().authenticated() ); http.addFilterBefore(customAuthenticationProcessingFilter(), UsernamePasswordAuthenticationFilter.class); http.exceptionHandling(httpSecurityExceptionHandlingConfigurer -> httpSecurityExceptionHandlingConfigurer .authenticationEntryPoint(new CustomLoginAuthenticationEntryPoint()) .accessDeniedHandler(customAccessDeniedHandler()) ); // http.userDetailsService(customUserDetailsService); // http.formLogin(); http.csrf().disable(); return http.build(); } // @formatter:on @Bean public AccessDeniedHandler customAccessDeniedHandler() { return new CustomAccessDeniedHandler(); } @Bean public AuthenticationSuccessHandler customAuthenticationSuccessHandler() { return new CustomAuthenticationSuccessHandler(); } @Bean public AuthenticationFailureHandler customAuthenticationFailureHandler() { return new CustomAuthenticationFailureHandler(); } } Ajax 로그인 처리 필터 소스public class CustomAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter { private final ObjectMapper objectMapper = new ObjectMapper(); private static final AntPathRequestMatcher DEFAULT_ANT_PATH_REQUEST_MATCHER = new AntPathRequestMatcher("/api/login", HttpMethod.POST.name()); public CustomAuthenticationProcessingFilter() { super(DEFAULT_ANT_PATH_REQUEST_MATCHER); } public CustomAuthenticationProcessingFilter(AuthenticationManager authenticationManager) { super(DEFAULT_ANT_PATH_REQUEST_MATCHER, authenticationManager); } @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { if (!request.getMethod().equals("POST")) { throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } LoginRequestDto loginRequestDto = objectMapper.readValue(request.getReader(), LoginRequestDto.class); if(StringUtils.isEmpty(loginRequestDto.getLoginId())||StringUtils.isEmpty(loginRequestDto.getLoginPassword())) { throw new IllegalStateException("Username or Password is empty"); } CustomAuthenticationToken authRequest = CustomAuthenticationToken.unauthenticated(loginRequestDto, loginRequestDto.getLoginPassword()); authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); return getAuthenticationManager().authenticate(authRequest); } } CustomAuthenticationToken 소스public class CustomAuthenticationToken extends AbstractAuthenticationToken { private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; private final Object principal; private Object credentials; public CustomAuthenticationToken(Object principal, Object credentials) { super(null); this.principal = principal; this.credentials = credentials; setAuthenticated(false); } public CustomAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { super(authorities); this.principal = principal; this.credentials = credentials; super.setAuthenticated(true); // must use super, as we override } public static CustomAuthenticationToken unauthenticated(Object principal, Object credentials) { return new CustomAuthenticationToken(principal, credentials); } public static CustomAuthenticationToken authenticated(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) { return new CustomAuthenticationToken(principal, credentials, authorities); } @Override public Object getCredentials() { return this.credentials; } @Override public Object getPrincipal() { return this.principal; } }
-
해결됨스프링 프레임워크는 내 손에 [스프1탄]
23.Spring MVC02 버전 만들기(Ajax, jQuery)
SPringMVC01 폴더를 복사 후, SpringMVC02 폴더로 변경해서 강의 순서대로 실행을 했는데, Mapping 경로를 찾지 못하는 오류가 발생했습니다. 그래서 해결 방법으로 [appServlet] - [servlet-context.xml] 파일 안에 19번째 줄 기존의 파일 내용 일부분을 수정했습니다. 이렇게 해도 괜찮을까요 ? 다른 방법이 있으면 알고 싶어요 ㅠ[servlet-context.xml] - 수정 전 <resources mapping="/resources/**" location="/resources/" /> [servlet-context.xml] - 수정 <resources mapping="/assets/**" location="/resources/assets/" /> <resources mapping="/ad_assets/**" location="/resources/ad_assets/" /> a
-
미해결스프링 프레임워크는 내 손에 [스프1탄]
Loading descript for 문제
안녕하세요! 나프에 이어 스프 강의까지 열심히 따라 가고 있는 학생입니다.강의 따라 열심히 실습하고 있는데요, API 설치 이후 위와 같은 팝업이 계속 뜨고 있습니다. 혼자 해결해보려고 구글 검색해봤지만, 뭐가 문제인지 모르겠습니다. ㅠ서버도 잘 작동되서 화면도 띄어지고 콘솔창에도 아무 문제가 나오지 않는데, 어떻게 해결하면 좋을까요?
-
미해결토비의 스프링 부트 - 이해와 원리
자동 구성 정보 분리가 안됩니다.
안녕하세요 자동 구성 정보 분리쪽 강의를 따라 구현하던 도중 문제가 발생하여 질문을 남깁니다. return new String[]{ "tobyspring.config.autoconfig.TomcatWebServerConfig", "tobyspring.config.autoconfig.DispatcherServletConfig" };직접 경로를 작성해주는 경우에는 문제 없이 동작합니다.Iterable<String> candidates = ImportCandidates.load(MyAutoConfiguration.class, classLoader); return StreamSupport.stream(candidates.spliterator(), false).toArray(String[]::new);클래스 로더를 이용해서 외부에서 파일 경로를 불러오는 방법을 사용하면 아래와 같은 문제가 발생합니다.오후 11:26:47: Executing ':HellobootApplication.main()'... > Task :compileJava > Task :processResources UP-TO-DATE > Task :classes > Task :HellobootApplication.main() FAILED . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.7.8) 2023-02-27 23:26:49.370 INFO 3532 --- [ main] t.helloboot.HellobootApplication : Starting HellobootApplication using Java 17.0.6 on yj_notebook with PID 3532 (C:\git\TID\helloboot\build\classes\java\main started by deter in C:\git\TID\helloboot) 2023-02-27 23:26:49.374 INFO 3532 --- [ main] t.helloboot.HellobootApplication : No active profile set, falling back to 1 default profile: "default" 2023-02-27 23:26:49.641 WARN 3532 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.context.MissingWebServerFactoryBeanException: No qualifying bean of type 'org.springframework.boot.web.servlet.server.ServletWebServerFactory' available: Unable to start AnnotationConfigServletWebServerApplicationContext due to missing ServletWebServerFactory bean 2023-02-27 23:26:49.667 ERROR 3532 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context. Action: Check your application's dependencies for a supported servlet web server. Check the configured web application type. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings 3 actionable tasks: 2 executed, 1 up-to-date FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':HellobootApplication.main()'. > Process 'command 'C:/Users/deter/.jdks/azul-17.0.6/bin/java.exe'' finished with non-zero exit value 1 * 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 2s 오후 11:26:49: Execution finished ':HellobootApplication.main()'. 제가 생각하기로는 클래스 로더를 통해서 구성 정보를 불러와야 하는데 못 불러오고 있는 것 같습니다.package tobyspring.config.autoconfig; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; import tobyspring.config.MyAutoConfiguration; @MyAutoConfiguration public class TomcatWebServerConfig { @Bean public ServletWebServerFactory servletWebServerFactory() { return new TomcatServletWebServerFactory(); } } 이 문제를 해결하기 위해서java 버전 11, 17gradle 버전 7.6, 8.0Build and run 을 Geadle, IntelliJ파일 경로 수정 등로 변경하는 방법들을 시도해봤지만 해결하지 못했습니다. 현재 제 개발 환경은 아래와 같습니다.IntelliJ버전은 2022.2.3 Community버전spring boot 2.7.8gradle 7.6어디서 문제가 발생하는지 감을 잡을 수 없어서 문의드립니다.
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
JdbcTemplate 테스트에서의 중복 회원 예외 오류가 뜨는 이유를 모르겠습니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (비슷한 내용은 있었지만 원하는 해답을 찾지 못했습니다)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]여기에 질문 내용을 남겨주세요.차근차근 강의 예제를 따라가면서 잘 오고 있었는데 테스트 하는 부분에서 갑작스런 오류로 인해 해답을 찾던 도중 어려움을 겪어서 프로젝트 링크와 오류 사진을 남기겠습니다https://drive.google.com/file/d/1DIAzsFD6RnTCv73h-kNpeDWUE5CsF8oC/view?usp=share_link
-
해결됨스프링 DB 1편 - 데이터 접근 핵심 원리
테스트 코드에서의 생성자 의존관계 주입 관련하여 질문 드립니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.안녕하세요. 강의 복습 중 해결되지 않는 의문점이 있어서 질문 드립니다. 테스트 코드에서 @TestCOnfiguration을 통해 해당 테스트 클래스에서 사용할 빈들을 등록을 하고, 의존성 주입을 할 때필드 주입은 정상 동작하지만, 생성자 주입은 정상 작동하지 않는지 의문이 생겨 질문 드립니다. 영한님께서는 필드 주입을 하셨고, 저는 복습 중에 생성자 주입으로 한 번 해볼까 하여 시도를 해봤는데 정상 동작하지 않았습니다. 아래는 생성자 주입을 시도해본 코드입니다./** * JDBC - 트랜잭션매니저를 통한 트랜잭션 + 트랜잭션 AOP(@Transactional) */ @SpringBootTest @RequiredArgsConstructor class MemberServiceV3_3Test { private static final String MEMBER_A = "memberA"; private static final String MEMBER_B = "memberB"; private static final String MEMBER_EX = "ex"; private final MemberServiceV3_3 memberService; private final MemberRepositoryV3 memberRepository; @TestConfiguration static class TestConfig { @Bean DataSource dataSource() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setJdbcUrl(URL); dataSource.setUsername(USERNAME); dataSource.setPassword(PASSWORD); return dataSource; } @Bean PlatformTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } @Bean MemberRepositoryV3 memberRepositoryV3() { return new MemberRepositoryV3(dataSource()); } @Bean MemberServiceV3_3 memberServiceV3_3() { return new MemberServiceV3_3(memberRepositoryV3()); } } @AfterEach void after() throws SQLException { memberRepository.delete(MEMBER_A); memberRepository.delete(MEMBER_B); memberRepository.delete(MEMBER_EX); } @Test @DisplayName("정상 이체") void accountTransfer() throws SQLException { memberRepository.save(new Member(MEMBER_A, 10000)); memberRepository.save(new Member(MEMBER_B, 10000)); // 커밋 memberService.accountTransfer(MEMBER_A, MEMBER_B, 2000); Member fromMember = memberRepository.findById(MEMBER_A); Member toMember = memberRepository.findById(MEMBER_B); assertThat(fromMember.getMoney()).isEqualTo(8000); assertThat(toMember.getMoney()).isEqualTo(12000); } @Test @DisplayName("이제 중 예외 발생") void accountTransferEx() throws SQLException { memberRepository.save(new Member(MEMBER_A, 10000)); memberRepository.save(new Member(MEMBER_EX, 10000)); // 예외 발생 // 롤백 assertThatThrownBy(() -> memberService.accountTransfer(MEMBER_A, MEMBER_EX, 2000)) .isInstanceOf(IllegalStateException.class); Member fromMember = memberRepository.findById(MEMBER_A); Member toMember = memberRepository.findById(MEMBER_EX); // 정상 이체 X // 롤백을 통해 돈은 트랜잭션 시작 전으로 복구된다. assertThat(fromMember.getMoney()).isEqualTo(10000); assertThat(toMember.getMoney()).isEqualTo(10000); } } (추가 질문)혹시나 해서 final 키워드를 제거하고 시도해보니 생성자 주입도 정상 동작하는 것을 발견했습니다. 테스트 코드를 실행할 때 어떤 과정 때문에 이러한 현상이 발생하는 지 궁금합니다.. 아래는 final 키워드를 제거한 코드입니다./** * JDBC - 트랜잭션매니저를 통한 트랜잭션 + 트랜잭션 AOP(@Transactional) */ @SpringBootTest class MemberServiceV3_3Test { private static final String MEMBER_A = "memberA"; private static final String MEMBER_B = "memberB"; private static final String MEMBER_EX = "ex"; private MemberServiceV3_3 memberService; private MemberRepositoryV3 memberRepository; @Autowired public MemberServiceV3_3Test(MemberServiceV3_3 memberService, MemberRepositoryV3 memberRepository) { this.memberService = memberService; this.memberRepository = memberRepository; } @TestConfiguration static class TestConfig { @Bean DataSource dataSource() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setJdbcUrl(URL); dataSource.setUsername(USERNAME); dataSource.setPassword(PASSWORD); return dataSource; } @Bean PlatformTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } @Bean MemberRepositoryV3 memberRepositoryV3() { return new MemberRepositoryV3(dataSource()); } @Bean MemberServiceV3_3 memberServiceV3_3() { return new MemberServiceV3_3(memberRepositoryV3()); } } ..... }
-
해결됨자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
31강 대출기능에서 테이블 생성에 대한 질문입니다.
대출기능을 개발하려고 하니,저희가 가진 두 테이블, User와 Book은 서로를 가리킬 필드가 없어서 '대출했다.'라는 정보를 표시할 수 없었습니다.그래서 user_loan_history 테이블을 새로 만드는 내용이 강의의 주된 내용이 되는데요,제가 궁금한건 여기서 User와 Book 테이블을 수정하여, 예를들면 User테이블에는 OneToMany로 Book의 id를 가리킬 수 있는 필드를, Book테이블에는 ManyToOne으로 User의 id를 가리킬 수 있는 필드를 추가하여 개발할 수도 있지 않나 싶어서요!객체지향적으로 생각했을 때 User와 Book은 객체지만, '대출기록'은 객체가 아니라 객체간의 관계 같아서 테이블로 만드는 것에 거부감이 생기는 것 같습니다.어떤 이유에서 기존의 테이블을 수정하지 않고, 새로운 테이블을 만들었는지 궁금합니다!