IT/Spring
Spring Boot Profile(application.yml)
민쌍
2021. 4. 8. 18:57
Profile Include
Spring Boot ~2.4
spring.application.name: "customers"
---
spring.profiles: "production"
spring.profiles.include: "mysql,rabbitmq"
---
spring:
profiles: "mysql"
datasource:
url: "jdbc:mysql://localhost/test"
username: "dbuser"
password: "dbpass"
---
spring:
profiles: "rabbitmq"
rabbitmq:
host: "localhost"
port: 5672
username: "admin"
password: "secret"
Spring Boot 2.4~
spring:
application:
name: "customers"
profiles:
group:
"production": "mysql,rabbitmq"
---
spring:
config:
activate:
on-profile: "mysql"
datasource:
url: "jdbc:mysql://localhost/test"
username: "dbuser"
password: "dbpass"
---
spring:
config:
activate:
on-profile: "rabbitmq"
rabbitmq:
host: "localhost"
port: 5672
username: "admin"
password: "secret"
Spring Boot Run
SPRING_PROFILES_ACTIVE=production
728x90
반응형