Chillax
Chillax

Reputation: 4698

Property file configuration after build, before deployment

Certain properties have been included in the properties file, referenced by the Spring's ApplicationConfiguration file (java based configuration). These are mostly url's and database properties which would vary based on the deployment environment.

The plan is to place the property file in the classpath. How would I be able to change the property file after the builld(Jenkins) is taken. I should be able to change the property file and deploy it again in the respective environment, without taking a new build. Any suggestions please?

Upvotes: 2

Views: 4952

Answers (2)

Sisifo
Sisifo

Reputation: 91

I recomend this aproximation: Override Properties file in Spring WebApp at Runtime

You only need something to point to your file. I use a JNDI properties. I think it is a very bad idea to change the war between enviorements.

Upvotes: 0

Steve
Steve

Reputation: 9480

The Spring documentation provides plenty of detail on your options for externalised config:

http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

The options available include placing application.properties / application.yml at the root of your classpath, so the simplest option is probably to place it in your tomcat conf directory.

Upvotes: 1

Related Questions