|
|
@ -776,8 +776,8 @@ public class CacheAutoConfigurationTests {
|
|
|
|
public void autoConfiguredCacheManagerCanBeSwapped() {
|
|
|
|
public void autoConfiguredCacheManagerCanBeSwapped() {
|
|
|
|
load(CacheManagerPostProcessorConfiguration.class, "spring.cache.type=caffeine");
|
|
|
|
load(CacheManagerPostProcessorConfiguration.class, "spring.cache.type=caffeine");
|
|
|
|
validateCacheManager(SimpleCacheManager.class);
|
|
|
|
validateCacheManager(SimpleCacheManager.class);
|
|
|
|
CacheManagerPostProcessor postProcessor = this.context.getBean(
|
|
|
|
CacheManagerPostProcessor postProcessor = this.context
|
|
|
|
CacheManagerPostProcessor.class);
|
|
|
|
.getBean(CacheManagerPostProcessor.class);
|
|
|
|
assertThat(postProcessor.cacheManagers).hasSize(1);
|
|
|
|
assertThat(postProcessor.cacheManagers).hasSize(1);
|
|
|
|
assertThat(postProcessor.cacheManagers.get(0))
|
|
|
|
assertThat(postProcessor.cacheManagers.get(0))
|
|
|
|
.isInstanceOf(CaffeineCacheManager.class);
|
|
|
|
.isInstanceOf(CaffeineCacheManager.class);
|
|
|
@ -1193,14 +1193,14 @@ public class CacheAutoConfigurationTests {
|
|
|
|
private final List<CacheManager> cacheManagers = new ArrayList<CacheManager>();
|
|
|
|
private final List<CacheManager> cacheManagers = new ArrayList<CacheManager>();
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Object postProcessBeforeInitialization(Object bean,
|
|
|
|
public Object postProcessBeforeInitialization(Object bean, String beanName)
|
|
|
|
String beanName) throws BeansException {
|
|
|
|
throws BeansException {
|
|
|
|
return bean;
|
|
|
|
return bean;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Object postProcessAfterInitialization(Object bean,
|
|
|
|
public Object postProcessAfterInitialization(Object bean, String beanName)
|
|
|
|
String beanName) throws BeansException {
|
|
|
|
throws BeansException {
|
|
|
|
if (bean instanceof CacheManager) {
|
|
|
|
if (bean instanceof CacheManager) {
|
|
|
|
this.cacheManagers.add((CacheManager) bean);
|
|
|
|
this.cacheManagers.add((CacheManager) bean);
|
|
|
|
return new SimpleCacheManager();
|
|
|
|
return new SimpleCacheManager();
|
|
|
|