Spring Download - Where to place property files when deployed to Tomcat?

I have Spring Bootbeen using it for several weeks now and am used to working with a file application.properties. I can use it for easy deployment and use with java jaror mvn spring-boot:run.

Now I am trying to deploy my application to the application server Tomcat 8.0.15. I read the documentation, but I cannot deploy the file warbecause Tomcat cannot find this famous application.propertiesfile. I want to say that if I want to output this file from war, where in my Tomcat installation should I put it for automatic reading?

+4
source share
3 answers

, , . Maven,

<project-folder>/src/main/java/

, WAR, Tomcat

catalina.properties 

shared.loader=

, , . .

, , , WAR.

+5

Spring

   1) A /config subdir of the current directory.
   2) The current directory
   3) A classpath /config package
   4) The classpath root 

. (23.2 ): http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config-application-property-files

( classpath).

+2

You can specify the location of the properties file as part of "JAVA_OPTS" in the file catalina.sh/catalina.batch or setEnv.bat / setEnv.sh. set JAVA_OPTS = -Dspring.config.location = file: / D: /Appconfig/application.properties

For information only: application.yaml does not load when spring boots during an external war and is defined as described above.

+2
source

All Articles