Environment Specific application.properties file in Spring Boot application -


in spring boot application, want create environment specific properties file. packaging type of application in war , executing in embedded tomcat. use sts , execute main sts itself.

  1. can have environment specific properties file application-${env-value}.properties?

in above case, env-value have values local/devl/test/prod

  1. where set env-value file? local, can set jvm argument through sts

  2. who reads application.properties in spring boot application.

  3. how load environment specific properties file? ex - if set database uid,pwd, schema etc in environment specific property file, in case datasource able understand properties in it?

  4. can use application.properties , application-local.properties file @ same time?

spring boot has support profile based properties.

simply add application-[profile].properties file , specify profiles use using spring.profiles.active property.

-dspring.profiles.active=local 

this load application.properties , application-local.properties latter overriding properties first.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -