@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2018 the original author or authors .
* Copyright 2002 - 2020 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -20,6 +20,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.cache.config.CacheManagementConfigUtils ;
import org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor ;
import org.springframework.cache.jcache.interceptor.JCacheInterceptor ;
import org.springframework.cache.jcache.interceptor.JCacheOperationSource ;
import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.context.annotation.Role ;
@ -36,17 +37,18 @@ import org.springframework.context.annotation.Role;
@@ -36,17 +37,18 @@ import org.springframework.context.annotation.Role;
* @see org . springframework . cache . annotation . EnableCaching
* @see org . springframework . cache . annotation . CachingConfigurationSelector
* /
@Configuration
@Configuration ( proxyBeanMethods = false )
@Role ( BeanDefinition . ROLE_INFRASTRUCTURE )
public class ProxyJCacheConfiguration extends AbstractJCacheConfiguration {
@Bean ( name = CacheManagementConfigUtils . JCACHE_ADVISOR_BEAN_NAME )
@Role ( BeanDefinition . ROLE_INFRASTRUCTURE )
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor ( ) {
BeanFactoryJCacheOperationSourceAdvisor advisor =
new BeanFactoryJCacheOperationSourceAdvisor ( ) ;
advisor . setCacheOperationSource ( cacheOperationSource ( ) ) ;
advisor . setAdvice ( cacheInterceptor ( ) ) ;
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor (
JCacheOperationSource jCacheOperationSource , JCacheInterceptor jCacheInterceptor ) {
BeanFactoryJCacheOperationSourceAdvisor advisor = new BeanFactoryJCacheOperationSourceAdvisor ( ) ;
advisor . setCacheOperationSource ( jCacheOperationSource ) ;
advisor . setAdvice ( jCacheInterceptor ) ;
if ( this . enableCaching ! = null ) {
advisor . setOrder ( this . enableCaching . < Integer > getNumber ( "order" ) ) ;
}
@ -55,9 +57,9 @@ public class ProxyJCacheConfiguration extends AbstractJCacheConfiguration {
@@ -55,9 +57,9 @@ public class ProxyJCacheConfiguration extends AbstractJCacheConfiguration {
@Bean ( name = "jCacheInterceptor" )
@Role ( BeanDefinition . ROLE_INFRASTRUCTURE )
public JCacheInterceptor cacheInterceptor ( ) {
public JCacheInterceptor cacheInterceptor ( JCacheOperationSource jCacheOperationSource ) {
JCacheInterceptor interceptor = new JCacheInterceptor ( this . errorHandler ) ;
interceptor . setCacheOperationSource ( cacheOperationSource ( ) ) ;
interceptor . setCacheOperationSource ( jCacheOperationSource ) ;
return interceptor ;
}