Search code examples
spring-bootehcachespring-cachejcache

How to set only one ehcache.xml in a multimodule project?


I have one "common" project where I want to put the ehcache.xml. Then, I have a series of spring boot projects, using the EnableCaching annotation in this way:

@EnableCaching
public class Project1SpringBoot {
     ....
     ....

Inside of the application property I have:

spring.cache.jcache.config: classpath:ehcache.xml

But I'd like to indicate the "common" project classpath, so I don't have to replicate the ehcache.xml file over n projects.

Is that possible? Or can you suggest me a different way?


Solution

  • What you are saying should work. If the common project contains the ehcache.xml file and the common project is in the classpath or your other projects, then classpath:ehcache.xml should work.