각 모듈의 build.gradle.kts에 다음과 같이 추가합니다.
dependencies {
implementation(project(":common")) // 추가
implementation("org.springframework.boot:spring-boot-starter-kafka")
implementation("org.springframework.boot:spring-boot-starter-webmvc")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
// ...
}

common모듈에서 사용하는 설정 변수가 없으면 실행 시 에러가 발생합니다.
필수 추가 항목
spring:
data:
redis:
host: ${SPRING_DATA_REDIS_HOST:localhost}
port: ${SPRING_DATA_REDIS_PORT:6379}
jwt:
secret: ${JWT_SECRET}
access-token-expire-seconds: ${JWT_ACCESS_TOKEN_EXPIRE_SECONDS:3600}
refresh-token-expire-seconds: ${JWT_ACCESS_TOKEN_EXPIRE_SECONDS:86400}
custom:
global:
internalBackUrl: ${INTERNAL_BACK_URL:<http://rarego-nginx>}
s3는 @ConditionalOnProperty 설정으로 모듈 별로 사용을 선택할 수 있습니다.
rarego:
s3:
enabled: true # Common의 S3Config가 작동함
aws:
access-key: "AKIA..." # 실제 키 필요
# 아하 설정들 필요
spring:
data:
redis:
host: ${SPRING_DATA_REDIS_HOST:localhost}
port: ${SPRING_DATA_REDIS_PORT:6379}
jwt:
secret: ${JWT_SECRET:dev-secret-key-have-to-change-abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz}
access-token-expire-seconds: ${JWT_ACCESS_TOKEN_EXPIRE_SECONDS:3600}
refresh-token-expire-seconds: ${JWT_ACCESS_TOKEN_EXPIRE_SECONDS:86400}
custom:
global:
internalBackUrl: ${INTERNAL_BACK_URL:<http://rarego-nginx>}
가끔 IntelliJ의 빌드 캐시가 꼬여서 리소스 파일 갱신이 안 될 때가 있습니다.
yml 불러오지 못해서 포트가 8080으로 실행되고 프로필이 default라면 프로젝트 rebuild를 해보시면 해결됩니다.
Build 클릭Rebuild Project 클릭