spring-boot-starter-cache
”, adding this to an application brings in all the dependencies to enable JSR-107 (JCACHE - Java Temporary Caching API)
and Spring caching annotations.@EnableCaching
to the required configuration class. This will automatically configure a suitable CacheManager to serve as a provider for the cache.@Configuration
@EnableCaching
public class CachingConfig {
@Bean
public CacheManager cacheManager() {
return new ConcurrentMapCacheManager("addresses");
}
}
@Cacheable("addresses")
public String getAddress(Customer customer) {...}