묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
패치 조인을 이렇게 이해해도 될까요?
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예[질문 내용]여기에 질문 내용을 남겨주세요.안녕하세요좋은 강의 만들어주셔서 감사합니다.강의를 보다가 이해가 어려운 부분이 있어서 질문드리고 싶은데패치조인을 이렇게 이해해도 될까요?1번 질문입니다.실무에서는 지연로딩으로 기본 세팅을 합니다.지연로딩은 즉시로딩보다 단점이 적기 때문입니다.(조인 개수와 성능 문제 관련)그러나 지연로딩도 최악의 경우 N+1 의 문제가 발생할 수 있습니다.그 보완책이 패치조인입니다.2번 질문입니다.패치조인은 지연로딩이 N+1 의 문제가 될 수 있는 특수한 상황에서만 즉시로딩을 할 수 있게 해줍니다.즉 연관관계에 있는 엔터티들을 JOIN FETCH로 명시하는 쿼리를 날려주면즉 하이버네이트가 해당 엔터티들끼리 조인을 날려줍니다.3번 질문입니다.아래의 쿼리가 잘못된 이유를 가르쳐주시면 감사하겠습니다.String query = "select t From Member m join fetch m.team t"; List<Team> result = em.createQuery(query, Team.class).getResultList(); 아래의 쿼리가select t From jpql.Member m join fetch m.team t SQL에서는 아래의 쿼리와 같다고 생각하는데 에러가 생깁니다. select team.* from member join team on member.team_id = team.id4번 질문입니다.3번 질문과 연관되는 질문입니다.1번째 쿼리는 되고 select m From jpql.Member m join fetch m.team 2번째 쿼리는 안되는 이유가 궁금합니다. select t From jpql.Member m join fetch m.team t 1번째 쿼리는 team이 있는 member를 가져오는 것이고 2번째 쿼리는 member가 있는 team을 가져오는 것이기 때문입니다. 그런데 JPA에서는 왜 2번째 쿼리가 오류가 발생하는건지 이해가 어려워 가르쳐주시면 감사하겠습니다.5번 질문입니다.아래의 쿼리는 왜 안되는건지 가르쳐주시면 감사하겠습니다.String query = "select m From Team t join fetch t.members m"; List<Member> result = em.createQuery(query, Member.class).getResultList(); 긴 질문을 읽어주셔서 감사합니다.
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
강의 11:54 단축키 질문입니다.
[질문 내용]안녕하세요. 강의 11:54초에 mappedBy 속성에 값을 넣을 때 사용하신 단축키를 알고 싶습니다(mac).감사합니다.
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
섹션1 JPA와 DB설정, 동작확인 Test 부분 오류.
[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)[질문 내용]여기에 질문 내용을 남겨주세요.해당 강의를 따라하던 중 오류가 도무지 해결되지 않아 질문글 남깁니다. 우선 저의 소스코드를 남기겠습니다.build.gradleMemberMemberRepositoryMemberRepositoryTest에서 A component required a bean of type 'jakarta.persistence.EntityManagerFactory' that could not be found. 오류가 발생합니다. SpringBoot에 일단 부딪혀보고자 시작한 강의라 아무리 구글링해봐도 어떻게 해결해야할지 막막합니다. build.gradle에서 MVCC=TRUE를 제거해봐도,build.gradle에 아래 코드를 추가해봐도,testImplementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'jakarta.persistence.EntityManagerFactory를 import해봐도,MemberRepositoryTest에 @ContextConfiguration(classes = MemberRepository.class)를 추가해봐도 해결할 수가 없었습니다. 버전이 맞지 않아서 생기는 부분이라면 처음부터 다시 진행하도록 하겠습니다. 도와주십쇼. 이하 오류 내용 전문입니다.C:\Users\User\.jdks\corretto-17.0.8.1\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.2\lib\idea_rt.jar=2852:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.2\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.2\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.2\plugins\junit\lib\junit-rt.jar;E:\OneDrive - 성균관대학교\바탕 화면\study\spring_boot\build\classes\java\test;E:\OneDrive - 성균관대학교\바탕 화면\study\spring_boot\build\classes\java\main;E:\OneDrive - 성균관대학교\바탕 화면\study\spring_boot\build\resources\main;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\3.1.4\f01d5f2ecbfef3159879c4a8450b49620ffb96c\spring-boot-starter-data-jpa-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-thymeleaf\3.1.4\15d1da5319a8504fe8913778b2360bdd0f35520c\spring-boot-starter-thymeleaf-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\3.1.4\a0da0751207173c93f9e92e74cae430b53544576\spring-boot-starter-web-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-devtools\3.1.4\41aad5bafdbcc2a5a07db8f937991f40fd8928f9\spring-boot-devtools-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\junit\junit\4.13.1\cdd00374f1fee76b11e2a9d127405aa3f6be5b6a\junit-4.13.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-test\3.1.4\1990ee664a265366b09ac723002f72697ebd0925\spring-boot-starter-test-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.querydsl\querydsl-jpa\5.0.0\2a653852848dee41b967d3520be3339f0f92f1ea\querydsl-jpa-5.0.0-jakarta.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\3.1.4\1842a0506c99583b5ce11525cbd3d52e719a3f8\spring-boot-starter-aop-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\3.1.4\d1c52a3392180c7925d32e5594a873db6c72239b\spring-boot-starter-jdbc-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.hibernate.orm\hibernate-core\6.2.9.Final\a24ca4a5c003b6d0d9e005c6226f84cf4169bfeb\hibernate-core-6.2.9.Final.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\3.1.4\c51bbed97c35a0c6abced4854db85a5a5b216540\spring-data-jpa-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\6.0.12\f9f903318add53a20c0e33ead1b16abd669543f7\spring-aspects-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\3.1.4\8a615e53a9f45eecc4821917b1423daa68afcf19\spring-boot-starter-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf-spring6\3.1.2.RELEASE\6030c7b4e260c41336f378e53da6e8531263f24b\thymeleaf-spring6-3.1.2.RELEASE.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\3.1.4\2dafafeb1ca78678a970947c51def69723c7442c\spring-boot-starter-json-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\3.1.4\b8f55488574671d085f8d31c137c6f6d8d79cc24\spring-boot-starter-tomcat-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\6.0.12\c7cf897d23da555a20e570d170f8f1541b04564d\spring-webmvc-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\6.0.12\89a20bbd7c1f973dc246b1d790b34e0b3e28e74d\spring-web-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\3.1.4\ae53253f6330787f8b77a13aa90d6514597a20d0\spring-boot-autoconfigure-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\3.1.4\7a0a6349e28227a93f2b4efde897e87b3343bf3a\spring-boot-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\2.2\3f2bd07716a31c395e2837254f37f21f0f0ab24b\hamcrest-core-2.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test-autoconfigure\3.1.4\129458471bf8a379613a09bdd2250a34ff169650\spring-boot-test-autoconfigure-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test\3.1.4\189c105270b2b109fbb26c709e2e42133aef5ab3\spring-boot-test-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.jayway.jsonpath\json-path\2.8.0\b4ab3b7a9e425655a0ca65487bbbd6d7ddb75160\json-path-2.8.0.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\4.0.1\ca2330866cbc624c7e5ce982e121db1125d23e15\jakarta.xml.bind-api-4.0.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\net.minidev\json-smart\2.4.11\cc5888f14a5768f254b97bafe8b9fd29b31e872e\json-smart-2.4.11.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.assertj\assertj-core\3.24.2\ebbf338e33f893139459ce5df023115971c2786f\assertj-core-3.24.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest\2.2\1820c0968dba3a11a1b30669bb1f01978a91dedc\hamcrest-2.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter\5.9.3\72e840501e1550e9799c9a5cc9483d7d6b29e0ba\junit-jupiter-5.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.mockito\mockito-junit-jupiter\5.3.1\d6ac0f6d54addf02def4ba1213f73a15ae6c2308\mockito-junit-jupiter-5.3.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.mockito\mockito-core\5.3.1\7cac313592a29ae5e29c52c22b15c3ae5ab561b2\mockito-core-5.3.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.skyscreamer\jsonassert\1.5.1\6d842d0faf4cf6725c509a5e5347d319ee0431c3\jsonassert-1.5.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-test\6.0.12\45ba109a7e19561dbbad64c9d033f2fecb434e85\spring-test-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\6.0.12\a55e70359371b03ee29dacd75c3b40d0baf3a656\spring-core-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.xmlunit\xmlunit-core\2.9.1\e5833662d9a1279a37da3ef6f62a1da29fcd68c4\xmlunit-core-2.9.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.querydsl\querydsl-core\5.0.0\7a469f78b7a89bae429f17766fb92687d0ab9e5b\querydsl-core-5.0.0.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\6.0.12\ba7ecdbdc2abaf172d49692b8110f65ecd2d250c\spring-aop-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.20\da562407e43f74c0f8f5f5df4065d85ec1736d01\aspectjweaver-1.9.20.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\6.0.12\cf14ce5078ab4b69b760ac91b2b9f23dab1e4457\spring-jdbc-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\5.0.1\a74c7f0a37046846e88d54f7cb6ea6d565c65f9c\HikariCP-5.0.1.jar;C:\Users\User\.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\User\.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\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\6.0.12\f1964518e07796b2fdc1b9be2108485ffe1b4566\spring-context-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\6.0.12\174d73f69d878fd7ddeef9a25213d8932692a768\spring-orm-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\3.1.4\7b16d91221c7f9492f63a99e97a1d907f6bf540c\spring-data-commons-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\6.0.12\b4e997baac7dd14593f3e4f815e3646279e9a63f\spring-tx-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\6.0.12\dfa53afbf1ab65f36c60333443ed1109ed331504\spring-beans-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.antlr\antlr4-runtime\4.10.1\10839f875928f59c622d675091d51a43ea0dc5f7\antlr4-runtime-4.10.1.jar;C:\Users\User\.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\User\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\2.0.9\7cf2726fdcfbc8610f9a71fb3ed639871f315340\slf4j-api-2.0.9.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\3.1.4\e3533d7b6e2e9b5ca9b05dce2a9a2504aad5b889\spring-boot-starter-logging-3.1.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.33\2cd0a87ff7df953f810c344bdf2fe3340b954c69\snakeyaml-1.33.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf\3.1.2.RELEASE\273997509a4c7aef86cee0521750140c587d9be2\thymeleaf-3.1.2.RELEASE.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.15.2\30d16ec2aef6d8094c5e2dce1d95034ca8b6cb42\jackson-datatype-jsr310-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.15.2\75f8d2788db20f6c587c7a19e94fb6248c314241\jackson-module-parameter-names-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.15.2\66a50e089cfd2f93896b9b6f7a734cea7bcf2f31\jackson-datatype-jdk8-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.15.2\9353b021f10c307c00328f52090de2bdb4b6ff9c\jackson-databind-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\10.1.13\540a79df9699435e4f7cb8983daab272d29d093f\tomcat-embed-websocket-10.1.13.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\10.1.13\6909967f2ed6c323108c2cc7f20586d6f7eb6455\tomcat-embed-core-10.1.13.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\10.1.13\22c8845f7528334905c582e48a3eeefab616b0a5\tomcat-embed-el-10.1.13.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\6.0.12\9283ad418f06f918e834b1981998a5f62a05b355\spring-expression-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\io.micrometer\micrometer-observation\1.11.4\1aa2f6ba1dae42c403543bd14ea5f302d7ed6d85\micrometer-observation-1.11.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\2.1.2\640c0d5aff45dbff1e1a1bc09673ff3a02b1ba12\jakarta.activation-api-2.1.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\net.minidev\accessors-smart\2.4.11\245ceca7bdf3190fbb977045c852d5f3c8efece1\accessors-smart-2.4.11.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.14.8\505d7d8937ff00cc55db79723e26c94069b87d66\byte-buddy-1.14.8.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-params\5.9.3\9e2a4bf6016a1975f408a73523392875cff7c26f\junit-jupiter-params-5.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-api\5.9.3\815818ad6ffcc8d320d8fbdf3d748c753cf83201\junit-jupiter-api-5.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.14.8\ae6ebe485f3bcd0a1e20241488a32e6400a501ef\byte-buddy-agent-1.14.8.jar;C:\Users\User\.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\User\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\6.0.12\44a1d1d105063d4eb9c5dc705245ef6fa4162520\spring-jcl-6.0.12.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.mysema.commons\mysema-commons-lang\0.2.4\d09c8489d54251a6c22fbce804bdd4a070557317\mysema-commons-lang-0.2.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.4.11\54450c0c783e896a1a6d88c043bd2f1daba1c382\logback-classic-1.4.11.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.20.0\d37f81f8978e2672bc32c82712ab4b3f66624adc\log4j-to-slf4j-2.20.0.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\2.0.9\9ef7c70b248185845f013f49a33ff9ca65b7975\jul-to-slf4j-2.0.9.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.attoparser\attoparser\2.0.7.RELEASE\e5d0e988d9124139d645bb5872b24dfa23e283cc\attoparser-2.0.7.RELEASE.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.unbescape\unbescape\1.1.6.RELEASE\7b90360afb2b860e09e8347112800d12c12b2a13\unbescape-1.1.6.RELEASE.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.15.2\4724a65ac8e8d156a24898d50fd5dbd3642870b8\jackson-annotations-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.15.2\a6fe1836469a69b3ff66037c324d75fc66ef137c\jackson-core-2.15.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\io.micrometer\micrometer-commons\1.11.4\6dfbbc07ecad294bffacff0648d6eaa4de78f332\micrometer-commons-1.11.4.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm\9.3\8e6300ef51c1d801a7ed62d07cd221aca3a90640\asm-9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apiguardian\apiguardian-api\1.1.2\a231e0d844d2721b0fa1b238006d15c6ded6842a\apiguardian-api-1.1.2.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.9.3\36b2e26a90c41603be7f0094bee80e3f8a2cd4d4\junit-platform-commons-1.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.2.0\28c11eb91f9b6d8e200631d46e20a7f407f2a046\opentest4j-1.2.0.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.4.11\2f9f280219a9922a74200eaf7138c4c17fb87c0f\logback-core-1.4.11.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.20.0\1fe6082e660daf07c689a89c94dc0f49c26b44bb\log4j-api-2.20.0.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.h2database\h2\2.1.214\d5c2005c9e3279201e12d4776c948578b16bf8b2\h2-2.1.214.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\4.0.3\93af25be25b2c92c83e0ce61cb8b3ed23568f316\jaxb-runtime-4.0.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.5.3.Final\c88fc1d8a96d4c3491f55d4317458ccad53ca663\jboss-logging-3.5.3.Final.jar;C:\Users\User\.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\User\.gradle\caches\modules-2\files-2.1\io.smallrye\jandex\3.0.5\c548a4871b552292dbdd65409d3fda145c8925c1\jandex-3.0.5.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\jakarta.inject\jakarta.inject-api\2.0.1\4c28afe1991a941d7702fe1362c365f0a8641d1e\jakarta.inject-api-2.0.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-engine\5.9.3\355322b03bf39306a183162cd06626c206f0286b\junit-jupiter-engine-5.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.objenesis\objenesis\3.3\1049c09f1de4331e8193e579448d0916d75b7631\objenesis-3.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-core\4.0.3\e9093b4a82069a1d78ee9a3233ca387bca88861f\jaxb-core-4.0.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.9.3\8616734a190f8d307376aeb7353dba0a2c037a09\junit-platform-engine-1.9.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.eclipse.angus\angus-activation\2.0.1\eaafaf4eb71b400e4136fc3a286f50e34a68ecb7\angus-activation-2.0.1.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\4.0.3\47b8fe31c6d1a3382203af919400527389e01e9c\txw2-4.0.3.jar;C:\Users\User\.gradle\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\4.1.2\18ec117c85f3ba0ac65409136afa8e42bc74e739\istack-commons-runtime-4.1.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 jpabook.jpashop.MemberRepositoryTest . ____ _ /\\ / ___'_ __ (_)_ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.1.4)2023-10-01T18:20:37.660+09:00 INFO 16440 --- [ main] jpabook.jpashop.MemberRepositoryTest : Starting MemberRepositoryTest using Java 17.0.8.1 with PID 16440 (started by 섹시쇼부맨 in E:\OneDrive - 성균관대학교\바탕 화면\study\spring_boot)2023-10-01T18:20:37.663+09:00 INFO 16440 --- [ main] jpabook.jpashop.MemberRepositoryTest : No active profile set, falling back to 1 default profile: "default"2023-10-01T18:20:37.805+09:00 WARN 16440 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberRepository': Injection of persistence dependencies failed2023-10-01T18:20:37.880+09:00 ERROR 16440 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************APPLICATION FAILED TO START***************************Description:A component required a bean of type 'jakarta.persistence.EntityManagerFactory' that could not be found.Action:Consider defining a bean of type 'jakarta.persistence.EntityManagerFactory' in your configuration.============================CONDITIONS EVALUATION REPORT============================Positive matches:----------------- NoneNegative matches:----------------- NoneExclusions:----------- NoneUnconditional classes:---------------------- None2023-10-01T18:20:37.884+09:00 ERROR 16440 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] to prepare test instance [jpabook.jpashop.MemberRepositoryTest@c0b41d6]java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@2e27d72f testClass = jpabook.jpashop.MemberRepositoryTest, locations = [], classes = [jpabook.jpashop.MemberRepository], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@19bb07ed, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@57c758ac, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@654f0d9c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@41e36e46, org.springframework.boot.test.context.SpringBootTestAnnotation@a3c756d2], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:143) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) ~[spring-test-6.0.12.jar:6.0.12] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.13.1.jar:4.13.1] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) ~[spring-test-6.0.12.jar:6.0.12] at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) ~[junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) ~[junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) ~[junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) ~[junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) ~[junit-4.13.1.jar:4.13.1] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-6.0.12.jar:6.0.12] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.run(ParentRunner.java:413) ~[junit-4.13.1.jar:4.13.1] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) ~[spring-test-6.0.12.jar:6.0.12] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) ~[junit-4.13.1.jar:4.13.1] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) ~[junit-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:232) ~[junit-rt.jar:na] at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) ~[junit-rt.jar:na]Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberRepository': Injection of persistence dependencies failed at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessProperties(PersistenceAnnotationBeanPostProcessor.java:388) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) ~[spring-context-6.0.12.jar:6.0.12] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137) ~[spring-boot-test-3.1.4.jar:3.1.4] at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[spring-core-6.0.12.jar:6.0.12] at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[spring-core-6.0.12.jar:6.0.12] at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1409) ~[spring-boot-3.1.4.jar:3.1.4] at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:545) ~[spring-boot-test-3.1.4.jar:3.1.4] at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137) ~[spring-boot-test-3.1.4.jar:3.1.4] at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108) ~[spring-boot-test-3.1.4.jar:3.1.4] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:187) ~[spring-test-6.0.12.jar:6.0.12] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:119) ~[spring-test-6.0.12.jar:6.0.12] ... 27 common frames omittedCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'jakarta.persistence.EntityManagerFactory' available at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1247) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:593) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:557) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:724) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:697) ~[spring-orm-6.0.12.jar:6.0.12] at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:270) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) ~[spring-beans-6.0.12.jar:6.0.12] at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessProperties(PersistenceAnnotationBeanPostProcessor.java:385) ~[spring-orm-6.0.12.jar:6.0.12] ... 49 common frames omittedjava.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@2e27d72f testClass = jpabook.jpashop.MemberRepositoryTest, locations = [], classes = [jpabook.jpashop.MemberRepository], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@19bb07ed, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@57c758ac, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@654f0d9c, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@41e36e46, org.springframework.boot.test.context.SpringBootTestAnnotation@a3c756d2], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:143) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) 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:232) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberRepository': Injection of persistence dependencies failed at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessProperties(PersistenceAnnotationBeanPostProcessor.java:388) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1409) at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:545) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:187) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:119) ... 27 moreCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'jakarta.persistence.EntityManagerFactory' available at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1247) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:593) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:557) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:724) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:697) at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:270) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:145) at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessProperties(PersistenceAnnotationBeanPostProcessor.java:385) ... 49 more
-
해결됨재고시스템으로 알아보는 동시성이슈 해결방법
TimeUnit이 안 됩니다
아래처럼 TimeUnit이 적용되지 않아서,구글링하여 maven 디펜던시 추가 등등 해보았지만 안됩니다.혹시나 다른 방법이 있는지 궁금해서 문의드려봅니다. java는 17입니다.
-
해결됨실전! Querydsl
PageableExecutionUtils.getPage 의 최적화 로직만 따로 뺀 count 메소드입니다.
갱신된 강의자료에도 나와 있듯이, fetchResult, fetchCount 등의 메소드는 deprecated 예정입니다. 또한 해당 메소드는 Page 타입을 반환하기 때문에 Page 타입을 직접적으로 조작해야 한다는 제약이 있습니다. 이걸 잘 쓰면 되는데, Page 의 시작번호 등 제약도 있어서 저는 회사에서 Page 를 따로 만들어서 사용하거든요. 그래서 search 메소드와 count 메소드는 항상 분리하고 있습니다.2. 그런 점에서 count 만 최적화하는 로직만 베껴서 만든 최적화 메소드입니다.실제로 count 구문을 실행하기 위한 메소드입니다. 필요에 따라서 public 으로 만들어도 될 것 같네요. // count 실행 메소드 private Long countByCond(MemberSearchCond cond) { return query .select(member.countDistinct()) .from(member) .where( usernameEq(cond.getUsername()), teamNameEq(cond.getTeamName()), ageGoe(cond.getAgeGoe()), ageLoe(cond.getAgeLoe()) ) .fetchOne(); } 최적화 로직을 베낀 메소드입니다. 스프링 데이터 JPA 는 아래 코드와 같이 page, size 값이 null 이 아니고, 적절한 범위에 있는지를 판단하여 isPaged 라는 분기를 만듭니다. 참고로 코드를 분석하면서 내린 뇌피셜이니 혹시 틀리다면 말씀해주세요. page 가 0 이 아니라 1 부터 시작하는 건 제 취향입니다. 회사에서 그렇게 쓰고 있거든요. 필요에 따라 0 부터 시작하도록 바꾸는 건 어렵지 않을 것 같습니다.public Long countByCondOptimization(List<?> content, MemberSearchCond cond, Long page, Long size) { boolean isPaged = page != null && size != null && page > 0 && size > 0; long offset = isPaged ? (page - 1) * size : 0L; long contentSize = content.size(); if (!isPaged || offset == 0) { if (!isPaged || size > contentSize) { return contentSize; } return this.countByCond(cond); } if (contentSize != 0 && size > contentSize) { return offset + contentSize; } return this.countByCond(cond); } 이렇게 하여 count 쿼리를 리스트 조회 쿼리와 분리하여 재사용성을 높이면서, 성능도 최적화할 수 있습니다.감사합니다.
-
해결됨실전! Querydsl
P6Spy 포맷 설정 공유합니다.
jpa 로그의 포맷처럼 줄바꿈을 넣으면서, 동시에 ? 자리에 바인딩 파라미터를 넣는 코드입니다. P6Spy 1.8.1, Spring Boot 2.7.x, 마리아DB 10.1.x 사용했습니다.application.properties 에서 JDBC 드라이버나 URL 에 P6Spy 를 추가하면 로그가 2번 출력될 수 있으니 주의하세요. 아래처럼 P6Spy 관련 드라이버? 코드? 가 포함되지 않도록 하시면 됩니다.# datasource spring.datasource.url=jdbc:mariadb://localhost:3306/YOUR_SCHEMA spring.datasource.username=YOUR_USERNAME spring.datasource.password=YOUR_PASSWORD # p6spy log logging.level.p6spy=info decorator.datasource.p6spy.enable-logging=true 로그의 포맷을 실질적으로 꾸미는 구현 클래스입니다. 추가 정보는 실행시간 제외하고는 뺐는데, 필요하시면 추가하시면 됩니다. import com.p6spy.engine.logging.Category; import com.p6spy.engine.spy.appender.MessageFormattingStrategy; import org.hibernate.engine.jdbc.internal.FormatStyle; import java.util.Locale; public class P6SpyFormatter implements MessageFormattingStrategy { private static final String NEW_LINE = "\n"; private static final String TAP = "\t"; private static final String CREATE = "create"; private static final String ALTER = "alter"; private static final String DROP = "drop"; private static final String COMMENT = "comment"; @Override public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) { if (sql.trim().isEmpty()) { return formatByCommand(category); } return formatBySql(sql, category) + getAdditionalMessages(elapsed); } private static String formatByCommand(String category) { return NEW_LINE + "Execute Command : " + NEW_LINE + NEW_LINE + TAP + category + NEW_LINE + NEW_LINE + "----------------------------------------------------------------------------------------------------"; } private String formatBySql(String sql, String category) { if (isStatementDDL(sql, category)) { return NEW_LINE + "Execute DDL : " + NEW_LINE + FormatStyle.DDL .getFormatter() .format(sql); } return NEW_LINE + "Execute DML : " + NEW_LINE + FormatStyle.BASIC .getFormatter() .format(sql); } private String getAdditionalMessages(long elapsed) { return NEW_LINE + NEW_LINE + String.format("Execution Time: %s ms", elapsed) + NEW_LINE + "----------------------------------------------------------------------------------------------------"; } private boolean isStatementDDL(String sql, String category) { return isStatement(category) && isDDL(sql.trim().toLowerCase(Locale.ROOT)); } private boolean isStatement(String category) { return Category.STATEMENT.getName().equals(category); } private boolean isDDL(String lowerSql) { return lowerSql.startsWith(CREATE) || lowerSql.startsWith(ALTER) || lowerSql.startsWith(DROP) || lowerSql.startsWith(COMMENT); } } 5. 아래 코드가 중요한데, 위 4에서 만든 포맷을 적용하는 시점을 알려주기 위해 만드는 JDBC 이벤트 리스너입니다. 어떤 블로그나 포럼에서는 포맷 적용 시점을 @PostConstruct 로 하던데, 그렇게 하면 테이블 create, drop 시점에 적용이 안 돼서 그렇게 하면 안 되고, 아래와 같이 Connection 이 생성되자마자 적용하면 됩니다. import com.p6spy.engine.common.ConnectionInformation; import com.p6spy.engine.event.JdbcEventListener; import com.p6spy.engine.spy.P6SpyOptions; import java.sql.SQLException; public class P6SpyEventListener extends JdbcEventListener { @Override public void onAfterGetConnection(ConnectionInformation connectionInformation, SQLException e) { P6SpyOptions.getActiveInstance().setLogMessageFormat(P6SpyFormatter.class.getName()); } } 이렇게 2개의 구현 클래스를 만들었으면, 아래와 같이 Bean 으로 등록해주기만 하면 설정 끝입니다. import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class P6SpyConfig { @Bean public P6SpyEventListener p6SpyCustomEventListener() { return new P6SpyEventListener(); } @Bean public P6SpyFormatter p6SpyCustomFormatter() { return new P6SpyFormatter(); } }
-
해결됨실전! Querydsl
동적으로 Order 절 만드는 코드 공유합니다
강의에서는 Query DSL 4.x 버전이어서 제네릭 없는 예제 코드인 것 같은데, 제가 올리는 버전은 5.0 버전이어서 차이가 있음을 감안해주세요.정렬 조건을 하나만 추가하는 코드입니다. 정렬 조건을 여러 개 추가하려면 반복문을 돌면서 JPAQuery 를 동적으로 확장해나가면 됩니다. // 페이징하는 메소드에서 사용 private Expression<? extends Comparable<?>> specifyMemberProperty(String prop) { prop = prop == null ? "" : prop.toLowerCase(); if (prop.equals("username")) { return member.username; } if (prop.equals("age")) { return member.age; } return member.id; } // 페이징하는 메소드 // ... .orderBy(new OrderSpecifier<>("desc".equalsIgnoreCase(dir) ? Order.DESC : Order.ASC, specifyMemberProperty(prop))) .fetch(); --저는 일단 이렇게 만들어봤는데, 다른 분께서 더 나은 코드, 더 빠른 코드가 있다면 저한테도 알려주세요.감사합니다.
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
@ManyToOne Category parent 질문 있습니다.
@ManyToOne@JoinColumn(name = "parent_id")private Category parent; @OneToMany(mappedBy = "parent")private List<Category> child = new ArrayList<>(); 안녕하세요.위 코드에서 부모 쪽에 다대일 매핑 한 이유를 알고 싶습니다.아니면 DB 테이블 안에서 부모 셀프 외래 키를 만들어서조회할 때 이 외래 키를 참조하여 자식 카테고리들까지 같이 조회하게 만들었기 때문에 테이블에서 다는 parent_id니까jpa에도 parent에 다를 준 건 가 싶기도 해서요필드 명에 부모 자식이 있어서 부모는 하나고 자식은 여러 개인데 부모 쪽에 다로 돼있어서 헷갈리네요..
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
@Transactional 이 자동완성에도 안뜨는데 어떻게 해결해야할 지 모르겠어요
spring boot 3, java 17 버전사용하고 있습니다
-
미해결스프링 시큐리티 OAuth2
진도에 관해서 질문있습니다
먼저 저번에 스프링 시큐리티 1편 강의를 듣고 전체적인 인증흐름 등 소개가 만족스러워서 이번에 oauth2 도 샀습니다. 단도직입적으로 얘기하면(OAuth2의 인증흐름+RESTAPI 식으로 OAuth2)를 어떤 식으로 코드를 짜는지 보고 싶습니다. 이에 대해 도움이 되는 강의 chapter를 먼저 수강하고 싶습니다. 학기 중이라 44시간을 듣기 좀 부담스럽기도 하고 한번 oauth2의 인증흐름+restAPI 식 oauth2를 먼저 구현하고 난 후에 다시 강의를 들을때 꼼꼼히 들을 예정입니다그래서 질문은1)(OAuth2의 인증흐름+RESTAPI 식으로 OAuth2)에 관련된 chapter를 소개해 주실수 있을까요??(예를 들면 MAC 등 이런 것은 제외하고요..)2)이거 쓰다가 궁금해지는게 소셜로그인-Form Login 을 수강하면 RESTAPI 식으로 바꾸는 것은 별차이가 없을까요?
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
기능이 버튼눌러서는 잘 작동안하는데 url검색하면 빠르게 동작
aws 로 서비스 배포하였는데 버튼눌러서 controller에 접근하는 url이 바뀔떄마다 엄청 느려서 기능접속이 잘안되네요 swap설정은 되어있는데 혹시 이유알수 있을까요 ??url을 직접쳐서 검색하는건 빨라요간단히 controller에서 template으로 정보 맞교환하는건데 이유 알수 있을까요? <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Hello</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../css/main.css"/> </head> <body> <div class="cd-switch"> <div class="switchUp"> <h1> <p th:text="${userName}+'님의 선택은 !? '"><br></p> </h1> <p th:text="' 원하는 걸 골라봐요 왼쪽? 오른쪽? 결과는 반영됩니다! '" style=" width: 1000px;"></p> <h2 > <p th:text="${question}" style=" width: 1000px;"></p> </h2> <html> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <body> <div class="w3-light-grey"> <div class="w3-green" th:style="'height:24px;width: ' + ${LeftPercent} + '%'">LEFT</div> </div><br> <div class="w3-light-grey"> <div class="w3-red" th:style="'height:24px;width: ' + ${RightPercent} + '%'">RIGHT</div> </div><br> <div class="w3-container"> <div class="w3-bar"> <form action="http://13.124.171.10:8081/leftQuestion" method="get"> <button class="w3-button w3-left w3-light-grey" type="submit" >« LEFT!</button> </form> <form action="http://13.124.171.10:8081/rightQuestion" method="get"> <button class="w3-button w3-right w3-green">RIGHT! »</button> </form> </div> </div> </body> </html> </div> </div> </body> </html> 이런식으로 url을 직접넣어서 ec2컴퓨터에 연결하는건 안되는 건가요??
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
gradle이 실행이 안됩니다
윈도우 환경에서 gardle을 빌드 시키려고 하면org.gradle.api.UncheckedIOException: Could not load properties for module 'gradle-cli' 이 오류가 뜹니다 인텔리제이 재설치,스프링 재설치,vscode로 실행등을 다 해봐도계속 저 오류가 뜹니다인텔리제이 재설치 이후에는 Unable to load class 'org.slf4j.LoggerFactory'.This is an unexpected error. Please file a bug containing the idea.log file.가 뜹니다
-
미해결스프링과 JPA 기반 웹 애플리케이션 개발
3:34 인증 메일 확인 - 입력값 오류
안녕하세요.아직 앞부분이지만 강의 최고입니다. 질문1테스트코드 인증 메일 확인 - 입력값 오류에 대해서 지금 로직은 이메일 자체가 없으니까 이메일이 없는 오류고 이메일은 존재하나 토큰이 일치 하지않는경우 이렇게 2가지로 테스트 코드를 진행할 필요까진 없는건가요 ? =================================질문25:45 초에는 @Transactional 을 달아주셨는데 이 이유가58 라인에 있는 newAccount.generateEmailCheckToken(); 코드를 영속객체로 관리 해주기 위함 이라고 생각하면 될까요?
-
해결됨[자바/Java] 문과생도 이해하는 DFS 알고리즘! - 입문편
바닥 장식 (백준 1388) 문제 질문입니당
저는 맵2차원배열을 boolean으로 사용하고싶어아래와 같이 코드를 작성해봤습니당... 예제입력1. 은 답이 잘나오는데 나머지는 왜 틀리게 나올까용... package DFS; import java.io.*; import java.util.StringTokenizer; import java.util.Vector; /* 바닥 장식 https://www.acmicpc.net/problem/1388 */ public class B1388 { final static int MAX =50+10; static boolean [][] map; static boolean [][] visited; static int M,N; static void dfs(int y, int x){ visited[y][x]=true; if (map[y][x]==true&& map[y][x+1]==true){ dfs(y, x + 1); } if(map[y][x]==false&&map[y+1][x]==false){ dfs(y+1,x ); } } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); map = new boolean[MAX][MAX]; visited = new boolean[MAX][MAX]; //맵정보 반영 for (int i = 1; i <= N; i++) { String str = br.readLine(); for (int j = 1; j <= M; j++) { map[i][j] = (str.charAt(j - 1) == '-' ? true : false); } } //dfs int answer=0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= M; j++) { if(map[i][j]&&visited[i][j]==false){ dfs(i,j); answer++; } } } bw.write(String.valueOf(answer)); bw.flush(); bw.close(); } }
-
미해결자바 ORM 표준 JPA 프로그래밍 - 기본편
Sequence 방식 allocation 기본 값 50에 대한 이해
안녕하세요 allocation 방식에 대해 좀 헷갈려서제가 이해한게 맞는지 문의 드릴려고 합니다.. 제 생각을 정리 해봤습니다. allocation 기본값 50 설정은 실제 DB 쿼리 문은 2번만 날려 시퀀스 값을 미리 51로 설정 해놓아 메모리상으로 51까지 순차적으로 증가시킨 후 51까지 도달되면 다시 DB로 시퀀스 증가 쿼리문을 날려 101로 증가돼 성능 이점을 챙긴다. 물리적 DBDB 한번 호출 시퀀스 값 1 / PK 값 1DB 두 번 호출 시퀀스 값 51 / PK 값 2===============================이제 메모리에서 1씩 가져옴 물리 DB PK 값이 51번까지 게속 사용PK 값이 51까지 도달된다면 DB로 시퀀스 50 증가 쿼리 전송동시성은 메모리에 이미 올라와 있는걸 사용하기 때문에 문제 없음
-
해결됨[자바/Java] 문과생도 이해하는 DFS 알고리즘! - 입문편
침투 (백준 13565) 문제중 질문입니당
아래 코드에서 왜DFS를 수행할때 MAP[1] 이 왜 고정인지 잘모르겠습니다... //맵정보 저장 for (int i = 1; i <= N; i++) { String str = br.readLine(); for (int j = 1; j <= M; j++) { map[i][j] = (str.charAt(j - 1) == '0' ? true : false); } } //dfs for (int j = 1; j <= M; j++) { if (map[1][j]) { // 왜 map[1][j] 일까요 dfs(1, j); // 또한 dfs도왜 1,j 일가요 } }
-
미해결실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
처음 저장한 데이터가 조회가 안됩니다.
안녕하세요. 현재 대학생이고 김영한님 강의를 본 후 프로젝트를 진행중입니다.다름이 아니라, 현재 Tale과 Keyword의 다대다 연관관계를 피하기 위해 중간에 TaleKeyword라는 중간 테이블을 두었고, Tale은 Member 테이블과 일대일 연관관계를 설정해두었습니다.동화(Tale)를 키워드, 회원정보에 끼워넣고 생성하는 API는 완성하였고 DB에 쌓이는 것까지 확인했습니다. 하지만, memberId를 이용해서 조회하려고 하니, 맨 처음 memberId가 1인 회원의 처음 저장한 taleId 1번의 데이터와 memberId가 2인 회원의 처음 저장한 동화인 taleId가 4인 동화가 조회가 안됩니다.(나머지 taleId 2, 3, 5번 데이터는 조회가 잘됩니다.) 쿼리문은 다음과 같이 짰고 영속성 문제인 것 같은데, 왜 첫번째 데이터만 조회가 안되는 걸까요?// 동화 목록조회(페이징) public List<Tale> findTalesByMemberId(Long memberId, int offset, int limit) { return em.createQuery( "select t from Tale t" + " join fetch t.member m" + " join fetch t.image.taleImage ti" + " where m.id = :memberId" + " order by t.createdTime desc", Tale.class ) .setParameter("memberId", memberId) .setFirstResult(offset) .setMaxResults(limit) .getResultList(); }
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
4. 모든 아나그램 찾기 질문
안녕하세요 다음 제 풀이가 테스트케이스 1,2번에서만 오류가 나는데 코드의 어느 부분이 잘못되었는지 모르겠어서 질문 드리고 싶습니다.import java.util.HashMap; import java.util.Scanner; public class Main { public static int solution(String S,String T){ int answer = 0; HashMap<Character,Integer> ThashMap = new HashMap<>(); for (char x: T.toCharArray()){ ThashMap.put(x, ThashMap.getOrDefault(x, 0)+1); } HashMap<Character,Integer> ShashMap = new HashMap<>(); // 1번째 윈도우 for (int i=0; i<T.length(); i++){ ShashMap.put(S.charAt(i), ShashMap.getOrDefault(S.charAt(i), 0)+1); } if (ThashMap.equals(ShashMap)) answer ++; // 나머지 윈도우 for (int i=T.length(); i<S.length()-1; i++){ ShashMap.put(S.charAt(i), ShashMap.getOrDefault(S.charAt(i), 0)+1); ShashMap.put(S.charAt(i-T.length()), ShashMap.get(S.charAt(i-T.length()))-1); if (ShashMap.get(S.charAt(i-T.length())) == 0) ShashMap.remove(S.charAt(i-T.length())); if (ThashMap.equals(ShashMap)) answer ++; } return answer; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str1 = sc.nextLine(); String str2 = sc.nextLine(); System.out.println(solution(str1,str2)); } }
-
해결됨실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
27번 라인의 order의 경우 왜 Long을 리턴값으로 작성하셨는지 궁금합니다.
단순히 void로 하셔도 무방하셨을 것 같은데, 혹시 어떤 이유가 있을까요? 혹시 이러한 패턴이 따로 있을까요?
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
강의 코딩자료는 어디에 있나요?
강사님께서 강의 도중에 복사하시는 코딩 자료랑강의노트는 어디서 다운로드 받을 수 있을까요?1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]여기에 질문 내용을 남겨주세요.