How to load ehCache.xml from external location in Spring Boot?

Out of the box the EhCache is looking for the ehCache.xml configuration file in resources path which is albo packed into jar file. In case when you want to use external ehCache.xml configuration file to can use the VM options and pass there appropriate value.

The most important part is the “file:” prefix before the path. Without it the application will looking for the configuration file in the classpath.

-Dspring.cache.jcache.config=file:<external_location>

For example:

-Dspring.cache.jcache.config=file:/spring-boot-apps/my-app/conf/ehcache.xml

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments