Closed
Description
The current CacheAutoConfiguration
has the following condition: @ConditionalOnMissingBean({ CacheManager.class, CacheResolver.class })
. If you want to configure your own custom CacheResolver
, something along the lines of
@Bean
@Lazy
public CacheResolver fooBarCacheResolver(CacheManager cacheManager) {
return new AbstractCacheResolver(cacheManager) { ... }
}
Then it blows up because the CacheManager
is no longer configured. And it isn't because we've defined a CacheResolver
.
But we haven't configured the CacheResolver
: we just have configured a CacheResolver
that can be used in a dedicated service.
Maybe we should use a bean name rather than a type.
The exception is also misleading:
java.lang.IllegalStateException: No CacheResolver specified, and no bean of type CacheManager found. Register a CacheManager bean or remove the @EnableCaching annotation from your configuration.