반응형
Env
gradle : 6.0
jdk : 11.0.5
kotlin jvm : 1.3.60
springframework : 2.1.10
entity 및 repository만 별도 module로 관리하고, 해당 entity 및 repository가 필요한 module에
dedependency를 걸어서 사용하기 위함dependency를 걸어서 사용하기 위함
1. Root project에서 module 추가 (entity 및 repository 구현을 위한 모듈)
2. 1에서 생성한 module의 build.gradle.kts에 아래내용 추가
val jar: Jar by tasks
val bootJar: BootJar by tasks
bootJar.enabled = false
jar.enabled = true
main메소드가 없기 때문에 위와같이 설정# gradle 빌드시에는 프로젝트를 실행가능한 jar형태로 만들게 되는데, 해당 프로젝트의 경우
3. Entity 및 Repository 사용할 dependency 설정
사용할 prj에 dependency를 설정한다.
- root prj의 build.gradle.kts에 project별 설정을 통해 입력
project("user_service_demo"){ //사용할 prj 명
dependencies {
implementation(project(":user_entity")) //dependency설정할 모듈
}
}
4. prj bean 주입설정
main class에 해당 annotation 설정
repository의 packages 설정을 위해 아래 annotation 사용.
@EnableReactiveMongoRepositories(basePackages = ["com.test.user_entity.repository"])
step4 미 설정시 repository를 찾지 못해 아래와 같은 build 에러 발생
Parameter 0 of constructor in com.test.test.TestRun required a bean of type 'com.test.user_entity.repository.UserRepository' that could not be found.
반응형
'IT Tech' 카테고리의 다른 글
Ubuntu에 Jenkins 설치하기 (0) | 2020.07.19 |
---|---|
Windows10 에서 React Js 실행을 위한 사전 준비 (Create-react-App) (0) | 2020.07.14 |
Maven 윈도우 설치 및 환경설정 방법 (0) | 2019.11.04 |
댓글