Mahesh Bhuva
Mahesh Bhuva

Reputation: 764

In Spring web app deployed to tomcat server, catalina.properties file is automatically loaded and detected by spring. HOW?

When developing a spring based web app (and deploying to tomcat), we can put our configuration in several places. One of them is catalina.properties. I would like to know how catalina.properties file is made available to spring app. Is it tomcat who does this or spring who loads catalina.properties file? How spring knows from where to load configurations.

Upvotes: 1

Views: 354

Answers (1)

Andy Wilkinson
Andy Wilkinson

Reputation: 116091

Tomcat automatically makes any properties configured in catalina.properties available as system properties. Spring's Environment uses a number of different sources for the properties that it contains. One of those sources is the JVM's system properties. As a result, the properties specified in catalina.properties are available via Spring's Environment.

Upvotes: 3

Related Questions