Spring Boot에서 Profile 환경별 설정
Springboot 2.4 버전 이전과 이후 버전에 대한 profile 설정이 바뀐 부분이 담겨 있으며
설정파일을 여러개로 나누는 것이 아닌 application.yml 하나로 환경별 분리를 한다.
(참고용으로 기록)
SpringBoot 2.4 이전
# default
spring:
profiles:
active: local
---
# local
spring:
profiles: local
..하위 추가 설정
---
# dev
spring:
profiles: dev
..하위 추가 설정
---
# prod
spring:
profiles: prod
..하위 추가 설정
SpringBoot 2.4 이후
# default
spring:
profiles:
active: local
..하위 추가 설정
---
# Set Prod Environment profile Setting
spring:
config:
activate:
on-profile: prod
..하위 추가 설정
---
# Set Staging Environment profile Setting
spring:
config:
activate:
on-profile: staging
..하위 추가 설정
---
# Set Dev Environment profile Setting
spring:
config:
activate:
on-profile: dev
..하위 추가 설정
---
# Set Local Environment profile Setting
spring:
config:
activate:
on-profile: local
..하위 추가 설정
# default
spring:
profiles:
active: local
..하위 추가 설정
---
# Set Prod Environment profile Setting
spring:
config:
activate:
on-profile: prod
..하위 추가 설정
---
# Set Staging Environment profile Setting
spring:
config:
activate:
on-profile: staging
..하위 추가 설정
---
# Set Dev Environment profile Setting
spring:
config:
activate:
on-profile: dev
..하위 추가 설정
---
# Set Local Environment profile Setting
spring:
config:
activate:
on-profile: local
---
# Set Staging & Prod Environment profile Setting
spring:
config:
activate:
on-profile: "staging | prod"
..하위 추가 설정
반응형
'🌈Backend > SpringBoot' 카테고리의 다른 글
[SpringBoot] Jeus배포를 위한 준비 (0) | 2021.11.25 |
---|