Browse Source

Use proxyBeanMethods=false on remaining internal configuration classes

Closes gh-24511
pull/25075/head
Juergen Hoeller 6 years ago
parent
commit
f09093132e
  1. 4
      spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java
  2. 9
      spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java
  3. 2
      spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java
  4. 4
      spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java
  5. 20
      spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java
  6. 4
      spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java
  7. 16
      spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java
  8. 2
      spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java
  9. 2
      spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java
  10. 4
      spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java
  11. 4
      spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java
  12. 4
      spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java

4
spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java vendored

@ -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.
@ -34,7 +34,7 @@ import org.springframework.context.annotation.Role; @@ -34,7 +34,7 @@ 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 AspectJCachingConfiguration extends AbstractCachingConfiguration {

9
spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java vendored

@ -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.
@ -19,6 +19,7 @@ package org.springframework.cache.aspectj; @@ -19,6 +19,7 @@ package org.springframework.cache.aspectj;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.cache.config.CacheManagementConfigUtils;
import org.springframework.cache.jcache.config.AbstractJCacheConfiguration;
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;
@ -33,15 +34,15 @@ import org.springframework.context.annotation.Role; @@ -33,15 +34,15 @@ 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 AspectJJCacheConfiguration extends AbstractJCacheConfiguration {
@Bean(name = CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheCacheAspect cacheAspect() {
public JCacheCacheAspect cacheAspect(JCacheOperationSource jCacheOperationSource) {
JCacheCacheAspect cacheAspect = JCacheCacheAspect.aspectOf();
cacheAspect.setCacheOperationSource(cacheOperationSource());
cacheAspect.setCacheOperationSource(jCacheOperationSource);
return cacheAspect;
}

2
spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java

@ -36,7 +36,7 @@ import org.springframework.scheduling.config.TaskManagementConfigUtils; @@ -36,7 +36,7 @@ import org.springframework.scheduling.config.TaskManagementConfigUtils;
* @see org.springframework.scheduling.annotation.AsyncConfigurationSelector
* @see org.springframework.scheduling.annotation.ProxyAsyncConfiguration
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class AspectJAsyncConfiguration extends AbstractAsyncConfiguration {

4
spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java vendored

@ -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.
@ -38,7 +38,7 @@ import org.springframework.lang.Nullable; @@ -38,7 +38,7 @@ import org.springframework.lang.Nullable;
* @since 4.1
* @see JCacheConfigurer
*/
@Configuration
@Configuration(proxyBeanMethods = false)
public class AbstractJCacheConfiguration extends AbstractCachingConfiguration {
@Nullable

20
spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java vendored

@ -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;
}

4
spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java vendored

@ -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.
@ -41,7 +41,7 @@ import org.springframework.util.CollectionUtils; @@ -41,7 +41,7 @@ import org.springframework.util.CollectionUtils;
* @since 3.1
* @see EnableCaching
*/
@Configuration
@Configuration(proxyBeanMethods = false)
public abstract class AbstractCachingConfiguration implements ImportAware {
@Nullable

16
spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java vendored

@ -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.
@ -35,16 +35,18 @@ import org.springframework.context.annotation.Role; @@ -35,16 +35,18 @@ import org.springframework.context.annotation.Role;
* @see EnableCaching
* @see CachingConfigurationSelector
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ProxyCachingConfiguration extends AbstractCachingConfiguration {
@Bean(name = CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() {
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor(
CacheOperationSource cacheOperationSource, CacheInterceptor cacheInterceptor) {
BeanFactoryCacheOperationSourceAdvisor advisor = new BeanFactoryCacheOperationSourceAdvisor();
advisor.setCacheOperationSource(cacheOperationSource());
advisor.setAdvice(cacheInterceptor());
advisor.setCacheOperationSource(cacheOperationSource);
advisor.setAdvice(cacheInterceptor);
if (this.enableCaching != null) {
advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
}
@ -59,10 +61,10 @@ public class ProxyCachingConfiguration extends AbstractCachingConfiguration { @@ -59,10 +61,10 @@ public class ProxyCachingConfiguration extends AbstractCachingConfiguration {
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor() {
public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) {
CacheInterceptor interceptor = new CacheInterceptor();
interceptor.configure(this.errorHandler, this.keyGenerator, this.cacheResolver, this.cacheManager);
interceptor.setCacheOperationSource(cacheOperationSource());
interceptor.setCacheOperationSource(cacheOperationSource);
return interceptor;
}

2
spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java

@ -41,7 +41,7 @@ import org.springframework.util.Assert; @@ -41,7 +41,7 @@ import org.springframework.util.Assert;
* @see LoadTimeWeavingConfigurer
* @see ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoaderAware {

2
spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java

@ -49,7 +49,7 @@ import org.springframework.util.StringUtils; @@ -49,7 +49,7 @@ import org.springframework.util.StringUtils;
* @since 3.2
* @see EnableMBeanExport
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class MBeanExportConfiguration implements ImportAware, EnvironmentAware, BeanFactoryAware {

4
spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java

@ -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.
@ -39,7 +39,7 @@ import org.springframework.util.CollectionUtils; @@ -39,7 +39,7 @@ import org.springframework.util.CollectionUtils;
* @since 3.1
* @see EnableAsync
*/
@Configuration
@Configuration(proxyBeanMethods = false)
public abstract class AbstractAsyncConfiguration implements ImportAware {
@Nullable

4
spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java

@ -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.
@ -37,7 +37,7 @@ import org.springframework.util.Assert; @@ -37,7 +37,7 @@ import org.springframework.util.Assert;
* @see EnableAsync
* @see AsyncConfigurationSelector
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration {

4
spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@ -35,7 +35,7 @@ import org.springframework.scheduling.config.TaskManagementConfigUtils; @@ -35,7 +35,7 @@ import org.springframework.scheduling.config.TaskManagementConfigUtils;
* @see EnableScheduling
* @see ScheduledAnnotationBeanPostProcessor
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class SchedulingConfiguration {

Loading…
Cancel
Save