Default Cache Manager with Spring Boot using @EnableCaching
The Spring Boot starter provides a simple cache provider which stores values in an instance of ConcurrentHashMap. This is the simplest possible thread-safe implementation of the caching mechanism.
If the @EnableCaching
annotation is present in your app, Spring Boot checks dependencies available on your class path and configures an appropriate CacheManager
. Depending on a chosen provider, some additional configuration may be required. You can find all information about configuration in the first link from this answer.
If you want to define explicitly (from any reason) the simplest cache manager (which uses ConcurrentHashMap under the hood), please do:
@Bean
public CacheManager cacheManager() {
return new org.springframework.cache.concurrent.ConcurrentMapCacheManager();
}