SpringApplication will load properties from application.properties files in the following locations and add them to the Spring Environment:
- A /config subdirectory of the current directory. - The current directory - A classpath /config package - The classpath root
The list is ordered by precedence (properties defined in locations higher in the list override those defined in lower locations).
Question: when running a war
file on a tomcat
server: how can I add an additional location for the application.properties
outside the classpath or the tomcat container, like d:application.properties
?
The custom location should get highest precedence regarding the locations above.
Problem is: I could of course add a /config
folder inside my exploded war in the tomcat webapps
folder, but then I'd lose any custom configuration if the webapps folder is cleaned and war is redeployed.
Thus I'd like to add an additional location outside.
See Question&Answers more detail:os