Initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
= SdlBaseBootApplication
|
||||
|
||||
SpringBoot 웹 애플리케이션을 배포할 때는 주로 embedded tomcat이 내장된 jar파일을 이용한다. 하지만 war 파일로 빌드, 배포를 진행해야 하는 경우를 위해 SpringBootServletInitializer를 상속받고 있다.
|
||||
|
||||
NOTE: https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.traditional-deployment[Spring Boot supports traditional deployment]
|
||||
|
||||
== SpringBootServletInitializer 상속
|
||||
.SdlBaseBootApplication
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
public class SdlBaseBootApplication extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(SdlBaseBootApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SdlBaseBootApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
== Profile 적용
|
||||
@Profile 을 이용하여 Profile 별로 다른 설정이 가능하다.
|
||||
아래는 spring.profiles.active(JAVA OPTS)에 따라서 변경되는 설정이다.
|
||||
|
||||
* 아래의 예는 local profile 에서만 적용된다.
|
||||
|
||||
[source, java]
|
||||
----
|
||||
@Configuration
|
||||
@Profile({"local"})
|
||||
public class DbcpDataSourceConfig {
|
||||
----
|
||||
|
||||
IMPORTANT: spring.profiles.active 는 runtime에서 매우 중요한 프로퍼티다. ServletContext에 등록되는 Filter, Servlet이 결정되고,
|
||||
Spring Bean의 생성도 결정되니 반드시 JAVA OPTS에 설정해야 한다.
|
||||
Reference in New Issue
Block a user