diff --git a/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java b/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java index 4f0a383d55a..e48a0f669a7 100644 --- a/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java +++ b/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJCachingConfiguration.java @@ -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; * @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 { diff --git a/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java b/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java index 524be193e2d..3468889517f 100644 --- a/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java +++ b/spring-aspects/src/main/java/org/springframework/cache/aspectj/AspectJJCacheConfiguration.java @@ -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; 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; * @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; } diff --git a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java index e13a595b42d..c6cdada3656 100644 --- a/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java +++ b/spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java @@ -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 { diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java index 8f751a99008..d881481e345 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java @@ -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 diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java index c779bfc10ae..c999000c52f 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/ProxyJCacheConfiguration.java @@ -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.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; } diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java b/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java index 07d8394c38a..c49d8d20c6e 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java @@ -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; * @since 3.1 * @see EnableCaching */ -@Configuration +@Configuration(proxyBeanMethods = false) public abstract class AbstractCachingConfiguration implements ImportAware { @Nullable diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java b/spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java index b5a468111bc..b7d35684b32 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/ProxyCachingConfiguration.java @@ -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; * @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.getNumber("order")); } @@ -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; } diff --git a/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java b/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java index 8c54ca4971b..477de756a8c 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java @@ -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 { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java b/spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java index 04fb3ff00bc..ea4f5b64a67 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/MBeanExportConfiguration.java @@ -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 { diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java index b269d75e1f3..60955d50077 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java @@ -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; * @since 3.1 * @see EnableAsync */ -@Configuration +@Configuration(proxyBeanMethods = false) public abstract class AbstractAsyncConfiguration implements ImportAware { @Nullable diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java index 86d3f8441dc..e3a5b310e57 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java @@ -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; * @see EnableAsync * @see AsyncConfigurationSelector */ -@Configuration +@Configuration(proxyBeanMethods = false) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration { diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java index 4991ff498fd..e02622c3beb 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfiguration.java @@ -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; * @see EnableScheduling * @see ScheduledAnnotationBeanPostProcessor */ -@Configuration +@Configuration(proxyBeanMethods = false) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public class SchedulingConfiguration {