SpringBoot profile에 따른 application.yml 적용방법
application 예시
spring:
profiles:
active: dev # 적용할 profiles 이름
devtools:
livereload:
enabled: true # js등의 최신 자동 반영
sql:
init:
mode: always # 서버 시작시 항상 classpath의 sql문을 실행하도록 설정
continue-on-error: true # 서버 시작시 sql문을 실행할 때 오류 무시하고 계속 진행
data-locations: classpath:sql/data-postgresql.sql # 서버 시작시 dml sql문을 실행할 위치 및 파일 지정
schema-locations: classpath:sql/schema-postgresql.sql # 서버 시작시 ddl sql문을 실행할 위치 및 파일 지정
--- # --- 구분자로 application.yml 파일을 여러개로 나눈다
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/testdb
username: test
password: test@@
config:
activate:
on-profile: test # profile 이름
server:
port: 8091
--- # --- 구분자로 application.yml 파일을 여러개로 나눈다
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/testdb2
username: test
password: test@@
config:
activate:
on-profile: dev # 해당 application.yml의 profile 이름
server:
port: 8092
--- 구분자
---
을 이용하면 .yml파일을 구분할 수 있게됩니다.
Author And Source
이 문제에 관하여(SpringBoot profile에 따른 application.yml 적용방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@bey1548/SpringBoot-profile에-따른-application.yml-적용방법저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)