Use proxyBeanMethods=false on remaining internal configuration classes
Closes gh-24511
This commit is contained in:
@@ -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.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.lang.Nullable;
|
||||
* @since 4.1
|
||||
* @see JCacheConfigurer
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class AbstractJCacheConfiguration extends AbstractCachingConfiguration {
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -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;
|
||||
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;
|
||||
* @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 {
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user