👣 개요
Spring Boot에서 설정값을 부여하는 방법은 하드 코딩 외에도 여러 가지를 지원한다.
- application.properties 파일
- application.yml 파일
- 환경 변수
- 커맨드 라인 Argments
👣 프로퍼티 우선 순위
- 유저 홈 디렉토리에 있는 spring-boot-dev-tools.properties
- 테스트에 있는 @TestPropertySource
- @SpringBootTest 의 properties 속성
- 커맨드 라인 Argments
- SPRING_APPLICATION_JSON (환경 변수 또는 시스템 프로티) 에 들어있는 프로퍼티
- ServletConfig 파라미터
- ServletContext 파라미터
- java:comp/env JNDI 애트리뷰트
- System.getProperties() 자바 시스템 프로퍼티
- OS 환경 변수
- RandomValuePropertySource
- JAR 밖에 있는 특정 프로파일용 application properties
- JAR 안에 있는 특정 프로파일용 application properties
- JAR 밖에 있는 application properties
- JAR 안에 있는 application properties
- @PropertySource
- 기본 프로퍼티 (SpringApplication.setDefaultProperties)
'Spring Boot' 카테고리의 다른 글
Spring Boot Bean 등록 방법 5가지 (0) | 2023.07.29 |
---|---|
Spring Logging System (0) | 2023.07.29 |
Spring Boot HTTP2 적용 (0) | 2023.07.28 |
Spring Boot HTTPS 적용 (0) | 2023.07.28 |
Executable Jar (0) | 2023.07.28 |