액티브 프로필 설정 방식

참고문서: https://emgc.tistory.com/130

spring:
	config:  
    active: 
			on-profile: "prod"
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
		...

스프링 실행시 옵션으로 전달


하나의 파일에 여러 프로필 넣는 방식

참고문서: https://1minute-before6pm.tistory.com/12

# local, dev, prod 공통 설정
server:
  port: 8080
  tomcat:
    uri-encoding: UTF-8

---

spring:
  profiles: local
  datasource:
    url: "jdbc:mysql://test-server/test"
    username: "dbuser"
    password: "dbpass"

---

spring:
  profiles: dev
  datasource:
    url: "jdbc:mysql://test-server/test"
    username: "dbuser"
    password: "dbpass"

spring boot에서 gradle에 정의돼 있는 정보 가져오기

참고문서: https://nevercaution.github.io/spring-boot-use-gradle-value/

build.gradle

processResources {
    filesMatching('**/application.yml') {
        expand(project.profiles)
    }
		filesMatching('**/application-prod.yml') {
        expand(project.profiles)
    }
}