@Bean
    protected EhCacheManager cacheManager() {

        EhCacheManager ehCacheManager = new EhCacheManager();

        // Set a net.sf.ehcache.CacheManager instance here if you already have one.
        // If not, a new one will be created with a default config:
        // ehCacheManager.setCacheManager(...);

        // If you don't have a pre-built net.sf.ehcache.CacheManager instance to inject, but you want
        // a specific Ehcache configuration to be used, specify that here.  If you don't, a default
        //will be used.:
        // ehCacheManager.setCacheManagerConfigFile("classpath:some/path/to/ehcache.xml");

        return ehCacheManager;
    }
Let's use some enterprise caching support for better performance.  You can replace this with any enterprise
caching framework implementation that you like (Terracotta+Ehcache, Coherence, GigaSpaces, etc

@return
samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/config/ApplicationConfig.java