Code example for CachingConfigurerSupport

0
	} 
 
 
	@Configuration 
	@EnableCaching 
	static class EnableCachingConfig extends CachingConfigurerSupport {
 
		@Override 
		@Bean 
		public org.springframework.cache.CacheManager cacheManager() {
			return new JCacheCacheManager(jCacheManager()); 
		} 
 
		@Bean 
		public CacheManager jCacheManager() {
			CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
			MutableConfiguration<Object, Object> mutableConfiguration = new MutableConfiguration<Object, Object>();
			mutableConfiguration.setStoreByValue(false);  // otherwise value has to be Serializable
			cacheManager.createCache("testCache", new JCacheConfiguration<Object, Object>(mutableConfiguration));
			cacheManager.createCache("primary", new JCacheConfiguration<Object, Object>(mutableConfiguration));