3

I have spring boot based war file deployed in tomcat. I am not able to use external application properties file. I am using following to provide the path of external properties file

X:\apache-tomcat-7.0.54\bin>startup.bat --Dspring.config.location=X:\conf\application.properties

I have also tried it with qoutes

X:\apache-tomcat-7.0.54\bin>startup.bat "--Dspring.config.location=X:\conf\application.properties"

These properties are not working and spring is reading properties file that are bundled inside the war file. Can anyone please help me with this? Thanks

amique
  • 2,176
  • 7
  • 34
  • 53
  • Using global parameters with an external Tomcat is awkward, because you could theoretically have multiple applications running on it. I have answered a similar question here, http://stackoverflow.com/questions/29106579/external-configuration-for-spring-boot-application/29122037#29122037 Posted as a comment here, because it's not a direct answer to your question, but you might consider going down this route instead – ci_ Apr 20 '15 at 13:36

1 Answers1

-1

Try

-Dspring.config.location=file:X:/conf/application.properties

You have to add file: if you need a file outside of classpath

Sezin Karli
  • 2,517
  • 19
  • 24
  • it is not working. Application is still reading properties files enclosed in war file – amique Apr 20 '15 at 07:42
  • can you edit CATALINA_HOME/bin/setenv.sh and add export CATALINA_OPTS="-Dspring.config.location=file:X:/conf/application.properties" – Sezin Karli Apr 20 '15 at 07:45
  • the setenv.bat works. I have added a setenv.bat file in my TOMCAT_HOME/bin folder and with set spring.config.location code and its was working but some how it is not the requirement – amique Apr 20 '15 at 07:58