해결방법: spring profiles active를 통해서 해결한다.
spring:
datasource:
hikari:
maximum-pool-size: 4
url: jdbc:postgresql://localhost:5432/postgres
username: postgres
password: pass
platform: postgres
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
default_schema: db
jwt:
secret: "12345678901234567890123456789010"
기존 yml 파일
spring:
profiles:
active: dev
---
spring:
profiles: dev
datasource:
hikari:
maximum-pool-size: 4
url: jdbc:postgresql://localhost:5432/postgres
username: postgres
password: pass
platform: postgres
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
default_schema: db
jwt:
secret: "12345678901234567890123456789010"
---
spring:
profiles: PROD
datasource:
hikari:
maximum-pool-size: 4
url: jdbc:postgresql://localhost:5432/postgres
username: postgres
password: pass
platform: postgres
jpa:
hibernate:
ddl-auto: none
properties:
hibernate:
default_schema: db
jwt:
secret: "12345678901234567890123456789010"
변경된 yml 파일
기존 yml 파일에서 spring.profiles.active 속성을 추가시키고 --- 를 통해서 dev 와 prod를 나누어 yml 파일을 작성한다.
실행 화면에는
이미지와 같이 dev 환경으로 실행이 되었다고 로그에 뜬다.