YAML 파일을 분리하기로 결정한 이유
1. 로컬 환경에서는 h2를, 개발 환경에서는 mysql을 사용하기 위해서
2. github에 올라가면 안될 정보들을 분리하기 위해서
YAML 파일들을 분리하기 위한 규칙
1. 파일 이름 설정하기
2. 파일 보관 장소 지정하기
3. application.yml 작성하기
1. 파일 이름 설정하기
Profile
환경에 따라 올바른 설정파일을 읽도록 유도하는 것
application-{profile}.yml
24. Externalized Configuration
Getters and setters are usually mandatory, since binding is through standard Java Beans property descriptors, just like in Spring MVC. A setter may be omitted in the following cases:Maps, as long as they are initialized, need a getter but not necessarily a
docs.spring.io
참고한 블로그
[Spring] 하나의 YAML을 여러 개로 나누어 환경 분리하기
https://velog.io/@devholic/Spring-YAML-%EC%97%AC%EB%9F%AC-%EA%B0%9C-%EC%93%B0%EA%B8%B0
[SpringBoot] Profile 사용하
https://lordofkangs.tistory.com/320
'F::d' 카테고리의 다른 글
스프링 record 성능 향상은? (1) | 2025.01.09 |
---|---|
CORS fillter VS WebMvcConfigurer.addCorsMappings (0) | 2025.01.02 |
@Bean, @Configuration 그리고 @Component (0) | 2025.01.02 |