Justin의 개발 로그
<html />
my-parent |__ my-main (depends on my-other module) |__ my-other
<html />
@SpringBootApplication public class MyMainApp ... { ... }
<html />
@SpringBootApplication @ConditionalOnProperty(name = "my.other.active", havingValue = "true", matchIfMissing = false) public class MyOtherApp ... { ... }

 

실행할 어플리케이션 선택 방법

<html />
-Dmy.other.active=true -Dspring.profiles.active=$profile

 

 

 

0.1. application yaml을 분리

  - 내부 실행 배치 

 

 

  - 외부 DB 접속하는 배치는 장애를 전파할 가능성이 있으니 접속 시스템별 분리

 

 

 

0.2. ComponentScan 을 yaml로 변경

 

 

 

 

 

1. yaml을 별도 경로로 분리해서 지정하거나, 여러 yaml을 포함시키는 방법

<html />
@SpringBootApplication public class Application { public static final String APPLICATION_LOCATIONS = "spring.config.location=" + "classpath:application.yml" + ",/app/config/springboot-webservice/real-application.yml" ; public static void main(String[] args) { new SpringApplicationBuilder(Application.class) .properties(APPLICATION_LOCATIONS) .run(args); }

 

classpath : 는 resources 하위의 상대경로에 있는 yaml이 로딩됨

/.../.../ 은 절대 경로로 서버에 배포되는 위치와 일치해야 함 

profile

Justin의 개발 로그

@라이프노트

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!