Setup EhCache using Spring’s Property Configurator

EhCache supports the ability to externalize cache configuration by reading specific properties from system properties

Similarly Spring’s support for property placeholder provides the flexibility to read application specific properties from externalized property files to configure various spring managed beans.

Mixing the two is pretty easy, and requires just a simple setup to push required ehcache configuration properties from spring property files into system properties using a technique explained here

See sample artifacts on GitHub, which include


See code below