Spring Boot

프로파일

상국이 2022. 2. 20. 14:41
728x90

@Profile

 > 특정 profile에서만 bean 을 등록하고 싶은 경우

 > application 동작을 특정 profile에서 bean설정을 다르게 하고 싶은 경우 사용

 

 * application.properties > spring.profiles.active에 설정해서 사용

spring.profiles.active=prd

 

* spring.profiles.include 를 통해 생성한 application-{profile}.properties 파일을 추가할 수 있음

spring.profiles.include=fullname

 

 > 이후 application-fullname.properties 생성 후 정의

 * application-{profile}.properties 파일이 우선순위가 더 높아서 application.properties를 오버라이딩함

728x90