SpringApplication
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.spring-application
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
- SpringApplication의 기본 log level은 INFO
Springboot Application을 실행하는 3가지 방법
@SpringBootApplication
public class SpringbootApplication {
/**
* 1안) 추가적인 커스터마이징이 불가
*/
public static void main(String[] args) {
SpringApplication.run(SpringbootApplication.class,args);
}
/**
* 2안) 객체 생성 후 set
*/
public static void main(String[] args) {
final SpringApplication springApplication = new SpringApplication(SpringbootApplication.class);
springApplication.setWebApplicationType(WebApplicationType.NONE);
springApplication.run(args);
}
/**
* 3안) builder를 활용
*/
public static void main(String[] args) {
new SpringApplicationBuilder()
.sources(SpringbootApplication.class)
.web(WebApplicationType.NONE)
.run(args);
}
}
SpringApplication Event
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
- ApplicationContext가 뜨기 이전의 EventListener들은 Bean으로 등록해도 동작하지 않는다. 그렇기 때문에 아래와 같이 직접 Listener를 등록해주어야 함
@SpringBootApplication
public class SpringbootApplication {
public static void main(String[] args) {
final SpringApplication springApplication = new SpringApplication(SpringbootApplication.class);
springApplication.addListeners(new SampleListener()); //Listener를 직접 등록
springApplication.setWebApplicationType(WebApplicationType.NONE);
springApplication.run(args);
}
}
WebApplicationType
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
Application Arguments
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
VM Options vs Application arguments Options
- -D로 시작하는건 VM
- --로 시작하는건 Application arguments
ApplicationRunner / CommandLineRunner
- SpringApplication이 실행된 후 특정 코드를 한번 수행하고 싶을 때 사용
If you need to run some specific code once the SpringApplication has started, you can implement the
ApplicationRunner or CommandLineRunner interfaces.
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
외부 설정
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
- 위 문서에 정의되어 있는 우선순위에 따라 외부 설정파일을 읽어들여옴
- 우선순위가 높은 key값이 아래 우선순위의 key값을 오버라이딩(덮어씀!)
application.properties들의 위치
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.files
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
ConfigurationProperties
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
@Validated
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
Profiles
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.profiles
Spring Boot Reference Documentation
This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration, and how to run your applications. We also cover some Spring Boot best practices. Although there is nothing particularly spe
docs.spring.io
- spring.profiles.group vs spring.profiles.include
2.4 버전 이상에서 부터 group을 사용해야하는듯
참고 :
http://honeymon.io/tech/2021/01/16/spring-boot-config-data-migration.html
댓글