Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.springframework.cache.CacheManager;
- import org.springframework.cache.annotation.EnableCaching;
- import org.springframework.cache.concurrent.ConcurrentMapCache;
- import org.springframework.cache.support.SimpleCacheManager;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.ComponentScan;
- import org.springframework.context.annotation.Configuration;
- @Configuration
- @EnableCaching
- public class CachingConfiguration {
- @Bean
- public CacheManager createCacheManager() {
- //We return a simple concurrent hashMap to be used as a cache
- //Spring supports more sophisticated cache managers such as encache, redis, mongodb, etc.
- //We return a dynamic ConcurrentMapCacheManager, lazily creating cache instances as they are being requested.
- return new ConcurrentMapCacheManager();
- }
- }
Add Comment
Please, Sign In to add comment