Spring은 실행시에 application.yml을 읽어들여 애플리케이션 수행 시에 필요한 메타 정보를 얻는다.
개발, 프로덕션 상황에 따라 DB나 로깅 등 다른 설정을 가질 수 있는데, 이를 profile로 구분해놓으면 필요한 상황에 맞게 설정을 적용할 수 있다.
Spring에서 지원하는 profile 설정 방식은 크게 세 가지이다.
--spring.profiles.active=local
web.xml
의 ServletContext의 파라미터로 설정<beans profile="dev">
<bean id="devDatasourceConfig"
class="org.baeldung.profiles.DevDatasourceConfig" />
</beans>
@Profile
로 프로파일 설정 작성하기