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

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s