I am using a Pivotal Cloud foundry with different testing environments (test, QA, UAT, PROD) Spring boot application I have created multiple properties files(Each pointing to different db) like
application-dev.properties
application-test.properties
application-qa.properties
application-uat.properties
application-prod.properties
if it is in local i am running by seting -Dspring.progiles.active=test/qa/uat/prod
mvn clean compile springboot:run -Dspring.progiles.active=test
How can I make it customize my application to use the specific properties file based on the environment in the cloud?
What all the configurations do I need to change? Below is my application.properties
file.
spring.profiles.active=test
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driver-class =org.hibernate.dialect.TeradataDialect
spring.jpa.database-platform=org.hibernate.dialect.TeradataDialect
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = none
spring.jpa.properties.hibernate.default_schema=
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.TeradataDialect
server.port=9090
logging.level.org.springframework.web=INFO
logging.level.org.hibernate=INFO
logging.file=myapplication.log
or do I need to change whenever I move to higher environments?
Thanks in advance.
You've to move all your property files to GIT by leveraging Spring Cloud Config Server. From your application, use bootstrap.yml file to connect with Config Server and you'll be providing the environment name like prod, dev, qa.