Category Archives: ehcache

Managing ehcache through Spring

There does not appear to be any documentation in the Spring manual about setting up an ehcache cache in your Spring container. There is a Spring bean built in to do it. To set it up with the default configuration, all that is needed is a line like this:

<bean id=”mediaCache” class=”org.springframework.cache.ehcache.EhCacheFactoryBean”/>

It looks like you can also customize quite a bit of the config without providing an ehcache.xml file. That could be nice so you don’t have to go chasing around to find all of the settings.