From f488db5a5571bb0eeaef4915f1db7a6c1c6dec56 Mon Sep 17 00:00:00 2001 From: Jong1 <44349716+donsonioc2010@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:21:25 +0900 Subject: [PATCH] =?UTF-8?q?chore=20:=20JpaRepository=20Method=20Call?= =?UTF-8?q?=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EA=B3=BC?= =?UTF-8?q?=EC=A0=95=EC=88=98=EC=A0=95=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=83=98=ED=94=8C=20=EC=B6=94=EA=B0=80=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Main ComponentScan을 Domain영역 추가 - Domain모듈에서 JPA를 implemention참조가아닌 API참조로 수정 - 변경한 사유는 implemention인 경우에는 Api모듈에서 JpaRepository인터페이스의 사용이 불가능해지지만, api를 통한 빌드를 할 경우에는 활요이 가능해진다. - Domain에서 작성해야하는 Entity, Repository의 Sample Code 작성 --- Api/src/main/java/picasso/server/api/Application.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Api/src/main/java/picasso/server/api/Application.java b/Api/src/main/java/picasso/server/api/Application.java index f91b7648..f6ae922e 100644 --- a/Api/src/main/java/picasso/server/api/Application.java +++ b/Api/src/main/java/picasso/server/api/Application.java @@ -6,10 +6,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.ComponentScan; - +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +// EnableJpaRepositories Reference : https://stackoverflow.com/questions/46732402/spring-boot-autowiring-of-beans-is-not-working-in-maven-multi-module-project @Slf4j @EntityScan("picasso.server.domain") -@ComponentScan("picasso.server.domain") +@ComponentScan(basePackages = {"picasso.server"}) +@EnableJpaRepositories(basePackages = {"picasso.server.domain"}) @SpringBootApplication @RequiredArgsConstructor public class Application {