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 06a589b6a27..b1aa1791d16 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-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -18,7 +18,7 @@ package org.springframework.cache.aspectj; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.cache.annotation.AbstractCachingConfiguration; -import org.springframework.context.annotation.AnnotationConfigUtils; +import org.springframework.cache.config.CacheManagementConfigUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; @@ -35,7 +35,7 @@ import org.springframework.context.annotation.Role; @Configuration public class AspectJCachingConfiguration extends AbstractCachingConfiguration { - @Bean(name=AnnotationConfigUtils.CACHE_ASPECT_BEAN_NAME) + @Bean(name = CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public AnnotationCacheAspect cacheAspect() { AnnotationCacheAspect cacheAspect = AnnotationCacheAspect.aspectOf(); 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 2a107709181..63076f476b6 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 @@ -17,9 +17,8 @@ package org.springframework.cache.aspectj; import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.cache.annotation.AbstractCachingConfiguration; +import org.springframework.cache.config.CacheManagementConfigUtils; import org.springframework.cache.jcache.config.AbstractJCacheConfiguration; -import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; @@ -37,7 +36,7 @@ import org.springframework.context.annotation.Role; @Configuration public class AspectJJCacheConfiguration extends AbstractJCacheConfiguration { - @Bean(name=AnnotationConfigUtils.JCACHE_ASPECT_BEAN_NAME) + @Bean(name = CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public JCacheCacheAspect cacheAspect() { JCacheCacheAspect cacheAspect = JCacheCacheAspect.aspectOf(); 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 a40a01ddb32..9484ff0c5bb 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -17,12 +17,12 @@ package org.springframework.scheduling.aspectj; import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; import org.springframework.scheduling.annotation.AbstractAsyncConfiguration; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.config.TaskManagementConfigUtils; /** * {@code @Configuration} class that registers the Spring infrastructure beans necessary @@ -37,7 +37,7 @@ import org.springframework.scheduling.annotation.EnableAsync; @Configuration public class AspectJAsyncConfiguration extends AbstractAsyncConfiguration { - @Bean(name=AnnotationConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME) + @Bean(name = TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public AnnotationAsyncExecutionAspect asyncAdvisor() { AnnotationAsyncExecutionAspect asyncAspect = AnnotationAsyncExecutionAspect.aspectOf(); diff --git a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AspectJTransactionManagementConfiguration.java b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AspectJTransactionManagementConfiguration.java index 582de644628..41993f81d47 100644 --- a/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AspectJTransactionManagementConfiguration.java +++ b/spring-aspects/src/main/java/org/springframework/transaction/aspectj/AspectJTransactionManagementConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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.transaction.config.TransactionManagementConfigUtils; @Configuration public class AspectJTransactionManagementConfiguration extends AbstractTransactionManagementConfiguration { - @Bean(name=TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME) + @Bean(name = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public AnnotationTransactionAspect transactionAspect() { AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf(); @@ -46,4 +46,5 @@ public class AspectJTransactionManagementConfiguration extends AbstractTransacti } return txAspect; } + } 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 646c7ece2af..028a6ccfb67 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 @@ -17,9 +17,9 @@ package org.springframework.cache.jcache.config; 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.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; @@ -38,7 +38,7 @@ import org.springframework.context.annotation.Role; @Configuration public class ProxyJCacheConfiguration extends AbstractJCacheConfiguration { - @Bean(name = AnnotationConfigUtils.JCACHE_ADVISOR_BEAN_NAME) + @Bean(name = CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor() { BeanFactoryJCacheOperationSourceAdvisor advisor = @@ -49,7 +49,6 @@ public class ProxyJCacheConfiguration extends AbstractJCacheConfiguration { return advisor; } - @Bean(name = "jCacheInterceptor") @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public JCacheInterceptor cacheInterceptor() { diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java b/spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java index 08478cc3164..5e783433465 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java @@ -21,7 +21,6 @@ import java.util.List; import org.springframework.context.annotation.AdviceMode; import org.springframework.context.annotation.AdviceModeImportSelector; -import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.AutoProxyRegistrar; import org.springframework.util.ClassUtils; @@ -36,19 +35,26 @@ import org.springframework.util.ClassUtils; * @since 3.1 * @see EnableCaching * @see ProxyCachingConfiguration - * @see AnnotationConfigUtils#CACHE_ASPECT_CONFIGURATION_CLASS_NAME - * @see AnnotationConfigUtils#JCACHE_ASPECT_CONFIGURATION_CLASS_NAME */ public class CachingConfigurationSelector extends AdviceModeImportSelector { private static final String PROXY_JCACHE_CONFIGURATION_CLASS = "org.springframework.cache.jcache.config.ProxyJCacheConfiguration"; + private static final String CACHE_ASPECT_CONFIGURATION_CLASS_NAME = + "org.springframework.cache.aspectj.AspectJCachingConfiguration"; + + private static final String JCACHE_ASPECT_CONFIGURATION_CLASS_NAME = + "org.springframework.cache.aspectj.AspectJJCacheConfiguration"; + + private static final boolean jsr107Present = ClassUtils.isPresent( "javax.cache.Cache", CachingConfigurationSelector.class.getClassLoader()); + private static final boolean jCacheImplPresent = ClassUtils.isPresent( PROXY_JCACHE_CONFIGURATION_CLASS, CachingConfigurationSelector.class.getClassLoader()); + /** * {@inheritDoc} * @return {@link ProxyCachingConfiguration} or {@code AspectJCacheConfiguration} for @@ -74,7 +80,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector result = new ArrayList(); result.add(AutoProxyRegistrar.class.getName()); result.add(ProxyCachingConfiguration.class.getName()); - if (isJCacheAvailable()) { + if (jsr107Present && jCacheImplPresent) { result.add(PROXY_JCACHE_CONFIGURATION_CLASS); } return result.toArray(new String[result.size()]); @@ -86,19 +92,11 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector result = new ArrayList(); - result.add(AnnotationConfigUtils.CACHE_ASPECT_CONFIGURATION_CLASS_NAME); - if (isJCacheAvailable()) { - result.add(AnnotationConfigUtils.JCACHE_ASPECT_CONFIGURATION_CLASS_NAME); + result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME); + if (jsr107Present && jCacheImplPresent) { + result.add(JCACHE_ASPECT_CONFIGURATION_CLASS_NAME); } return result.toArray(new String[result.size()]); } - /** - * Specify if the JSR-107 API and Spring's jCache implementation are available - * in the classpath. - */ - private boolean isJCacheAvailable() { - return jsr107Present && jCacheImplPresent; - } - } 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 b45707d66d4..e05f13f0e5a 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 @@ -17,10 +17,10 @@ package org.springframework.cache.annotation; import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.cache.config.CacheManagementConfigUtils; import org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor; import org.springframework.cache.interceptor.CacheInterceptor; import org.springframework.cache.interceptor.CacheOperationSource; -import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Role; @@ -37,11 +37,11 @@ import org.springframework.context.annotation.Role; @Configuration public class ProxyCachingConfiguration extends AbstractCachingConfiguration { - @Bean(name=AnnotationConfigUtils.CACHE_ADVISOR_BEAN_NAME) + @Bean(name = CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME) @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() { BeanFactoryCacheOperationSourceAdvisor advisor = - new BeanFactoryCacheOperationSourceAdvisor(); + new BeanFactoryCacheOperationSourceAdvisor(); advisor.setCacheOperationSource(cacheOperationSource()); advisor.setAdvice(cacheInterceptor()); advisor.setOrder(this.enableCaching.getNumber("order")); diff --git a/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java b/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java index c3fad09bcf7..4ea5ccad0aa 100644 --- a/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java +++ b/spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java @@ -16,8 +16,6 @@ package org.springframework.cache.config; -import static org.springframework.context.annotation.AnnotationConfigUtils.*; - import org.w3c.dom.Element; import org.springframework.aop.config.AopNamespaceUtils; @@ -28,7 +26,6 @@ import org.springframework.beans.factory.parsing.CompositeComponentDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.cache.annotation.AnnotationCacheOperationSource; import org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor; import org.springframework.cache.interceptor.CacheInterceptor; import org.springframework.util.ClassUtils; @@ -57,11 +54,20 @@ import org.springframework.util.StringUtils; */ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser { + private static final String CACHE_ASPECT_CLASS_NAME = + "org.springframework.cache.aspectj.AnnotationCacheAspect"; + + private static final String JCACHE_ASPECT_CLASS_NAME = + "org.springframework.cache.aspectj.JCacheCacheAspect"; + + private static final boolean jsr107Present = ClassUtils.isPresent( "javax.cache.Cache", AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader()); private static final boolean jCacheImplPresent = ClassUtils.isPresent( - JCACHE_OPERATION_SOURCE_CLASS, AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader()); + "org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource", + AnnotationDrivenCacheBeanDefinitionParser.class.getClassLoader()); + /** * Parses the '{@code }' tag. Will @@ -122,17 +128,18 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser return def; } + /** * Configure the necessary infrastructure to support the Spring's caching annotations. */ private static class SpringCachingConfigurer { private static void registerCacheAdvisor(Element element, ParserContext parserContext) { - if (!parserContext.getRegistry().containsBeanDefinition(CACHE_ADVISOR_BEAN_NAME)) { + if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)) { Object eleSource = parserContext.extractSource(element); // Create the CacheOperationSource definition. - RootBeanDefinition sourceDef = new RootBeanDefinition(AnnotationCacheOperationSource.class); + RootBeanDefinition sourceDef = new RootBeanDefinition("org.springframework.cache.annotation.AnnotationCacheOperationSource"); sourceDef.setSource(eleSource); sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef); @@ -156,13 +163,12 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser if (element.hasAttribute("order")) { advisorDef.getPropertyValues().add("order", element.getAttribute("order")); } - parserContext.getRegistry().registerBeanDefinition(CACHE_ADVISOR_BEAN_NAME, advisorDef); + parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME, advisorDef); - CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), - eleSource); + CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource); compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName)); compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName)); - compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CACHE_ADVISOR_BEAN_NAME)); + compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)); parserContext.registerComponent(compositeDef); } } @@ -177,24 +183,25 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser * */ private static void registerCacheAspect(Element element, ParserContext parserContext) { - if (!parserContext.getRegistry().containsBeanDefinition(CACHE_ASPECT_BEAN_NAME)) { + if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(CACHE_ASPECT_CLASS_NAME); def.setFactoryMethodName("aspectOf"); parseCacheResolution(element, def, false); CacheNamespaceHandler.parseKeyGenerator(element, def); - parserContext.registerBeanComponent(new BeanComponentDefinition(def, CACHE_ASPECT_BEAN_NAME)); + parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)); } } } + /** * Configure the necessary infrastructure to support the standard JSR-107 caching annotations. */ private static class JCacheCachingConfigurer { private static void registerCacheAdvisor(Element element, ParserContext parserContext) { - if (!parserContext.getRegistry().containsBeanDefinition(JCACHE_ADVISOR_BEAN_NAME)) { + if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)) { Object eleSource = parserContext.extractSource(element); // Create the CacheOperationSource definition. @@ -202,7 +209,8 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef); // Create the CacheInterceptor definition. - RootBeanDefinition interceptorDef = new RootBeanDefinition(JCACHE_INTERCEPTOR_CLASS); + RootBeanDefinition interceptorDef = + new RootBeanDefinition("org.springframework.cache.jcache.interceptor.JCacheInterceptor"); interceptorDef.setSource(eleSource); interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); interceptorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName)); @@ -210,7 +218,8 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef); // Create the CacheAdvisor definition. - RootBeanDefinition advisorDef = new RootBeanDefinition(JCACHE_ADVISOR_FACTORY_CLASS); + RootBeanDefinition advisorDef = new RootBeanDefinition( + "org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor"); advisorDef.setSource(eleSource); advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName)); @@ -218,19 +227,18 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser if (element.hasAttribute("order")) { advisorDef.getPropertyValues().add("order", element.getAttribute("order")); } - parserContext.getRegistry().registerBeanDefinition(JCACHE_ADVISOR_BEAN_NAME, advisorDef); + parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME, advisorDef); - CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), - eleSource); + CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource); compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName)); compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName)); - compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, JCACHE_ADVISOR_BEAN_NAME)); + compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)); parserContext.registerComponent(compositeDef); } } private static void registerCacheAspect(Element element, ParserContext parserContext) { - if (!parserContext.getRegistry().containsBeanDefinition(JCACHE_ASPECT_BEAN_NAME)) { + if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)) { Object eleSource = parserContext.extractSource(element); RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(JCACHE_ASPECT_CLASS_NAME); @@ -241,13 +249,13 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser def.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName)); parserContext.registerBeanComponent(new BeanComponentDefinition(sourceDef, sourceName)); - parserContext.registerBeanComponent(new BeanComponentDefinition(def, JCACHE_ASPECT_BEAN_NAME)); + parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)); } } - private static RootBeanDefinition createJCacheOperationSourceBeanDefinition( - Element element, Object eleSource) { - RootBeanDefinition sourceDef = new RootBeanDefinition(JCACHE_OPERATION_SOURCE_CLASS); + private static RootBeanDefinition createJCacheOperationSourceBeanDefinition(Element element, Object eleSource) { + RootBeanDefinition sourceDef = + new RootBeanDefinition("org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource"); sourceDef.setSource(eleSource); sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); // JSR-107 support should create an exception cache resolver with the cache manager diff --git a/spring-context/src/main/java/org/springframework/cache/config/CacheAdviceParser.java b/spring-context/src/main/java/org/springframework/cache/config/CacheAdviceParser.java index f83d795550f..07bcea27aae 100644 --- a/spring-context/src/main/java/org/springframework/cache/config/CacheAdviceParser.java +++ b/spring-context/src/main/java/org/springframework/cache/config/CacheAdviceParser.java @@ -30,7 +30,6 @@ import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.cache.annotation.AnnotationCacheOperationSource; import org.springframework.cache.interceptor.CacheEvictOperation; import org.springframework.cache.interceptor.CacheInterceptor; import org.springframework.cache.interceptor.CacheOperation; @@ -79,8 +78,8 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser { } else { // Assume annotations source. - builder.addPropertyValue("cacheOperationSources", new RootBeanDefinition( - AnnotationCacheOperationSource.class)); + builder.addPropertyValue("cacheOperationSources", + new RootBeanDefinition("org.springframework.cache.annotation.AnnotationCacheOperationSource")); } } diff --git a/spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java b/spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java new file mode 100644 index 00000000000..1ea61503f39 --- /dev/null +++ b/spring-context/src/main/java/org/springframework/cache/config/CacheManagementConfigUtils.java @@ -0,0 +1,39 @@ +/* + * Copyright 2002-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cache.config; + +/** + * Configuration constants for internal sharing across subpackages. + * + * @author Juergen Hoeller + * @since 4.1 + */ +public class CacheManagementConfigUtils { + + public static final String CACHE_ADVISOR_BEAN_NAME = + "org.springframework.cache.config.internalCacheAdvisor"; + + public static final String CACHE_ASPECT_BEAN_NAME = + "org.springframework.cache.config.internalCacheAspect"; + + public static final String JCACHE_ADVISOR_BEAN_NAME = + "org.springframework.cache.config.internalJCacheAdvisor"; + + public static final String JCACHE_ASPECT_BEAN_NAME = + "org.springframework.cache.config.internalJCacheAspect"; + +} diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java index 2298a429acd..713ae8d567a 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java @@ -95,114 +95,6 @@ public class AnnotationConfigUtils { public static final String COMMON_ANNOTATION_PROCESSOR_BEAN_NAME = "org.springframework.context.annotation.internalCommonAnnotationProcessor"; - /** - * The bean name of the internally managed Scheduled annotation processor. - */ - public static final String SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME = - "org.springframework.context.annotation.internalScheduledAnnotationProcessor"; - - /** - * The bean name of the internally managed Async annotation processor. - */ - public static final String ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME = - "org.springframework.context.annotation.internalAsyncAnnotationProcessor"; - - /** - * The bean name of the internally managed AspectJ async execution aspect. - */ - public static final String ASYNC_EXECUTION_ASPECT_BEAN_NAME = - "org.springframework.scheduling.config.internalAsyncExecutionAspect"; - - /** - * The class name of the AspectJ async execution aspect. - */ - public static final String ASYNC_EXECUTION_ASPECT_CLASS_NAME = - "org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect"; - - /** - * The name of the AspectJ async execution aspect @{@code Configuration} class. - */ - public static final String ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME = - "org.springframework.scheduling.aspectj.AspectJAsyncConfiguration"; - - /** - * The bean name of the internally managed cache advisor. - */ - public static final String CACHE_ADVISOR_BEAN_NAME = - "org.springframework.cache.config.internalCacheAdvisor"; - - /** - * The bean name of the internally managed cache aspect. - */ - public static final String CACHE_ASPECT_BEAN_NAME = - "org.springframework.cache.config.internalCacheAspect"; - - /** - * The class name of the AspectJ caching aspect. - */ - public static final String CACHE_ASPECT_CLASS_NAME = - "org.springframework.cache.aspectj.AnnotationCacheAspect"; - - /** - * The name of the AspectJ caching aspect @{@code Configuration} class. - */ - public static final String CACHE_ASPECT_CONFIGURATION_CLASS_NAME = - "org.springframework.cache.aspectj.AspectJCachingConfiguration"; - - /** - * The bean name of the internally managed JSR-107 cache advisor. - */ - public static final String JCACHE_ADVISOR_BEAN_NAME = - "org.springframework.cache.config.internalJCacheAdvisor"; - - /** - * The class name of the JSR-107 cache operation source. - */ - public static final String JCACHE_OPERATION_SOURCE_CLASS - = "org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource"; - - /** - * The class name of the JSR-107 cache interceptor. - */ - public static final String JCACHE_INTERCEPTOR_CLASS = - "org.springframework.cache.jcache.interceptor.JCacheInterceptor"; - - /** - * The class name of the JSR-107 cache advisor factory. - */ - public static final String JCACHE_ADVISOR_FACTORY_CLASS = - "org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor"; - - /** - * The bean name of the internally managed JSR-107 cache aspect. - */ - public static final String JCACHE_ASPECT_BEAN_NAME = - "org.springframework.cache.config.internalJCacheAspect"; - - /** - * The class name of the AspectJ JSR-107 cache aspect. - */ - public static final String JCACHE_ASPECT_CLASS_NAME = - "org.springframework.cache.aspectj.JCacheCacheAspect"; - - /** - * The name of the AspectJ JSR-107 cache aspect @{@code Configuration} class. - */ - public static final String JCACHE_ASPECT_CONFIGURATION_CLASS_NAME = - "org.springframework.cache.aspectj.AspectJJCacheConfiguration"; - - /** - * The bean name of the internally managed jms listener annotation processor. - */ - public static final String JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME = - "org.springframework.jms.config.internalJmsListenerAnnotationProcessor"; - - /** - * The bean name of the internally managed jms listener endpoint registry. - */ - public static final String JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME = - "org.springframework.jms.config.internalJmsListenerEndpointRegistry"; - /** * The bean name of the internally managed JPA annotation processor. */ diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurationSelector.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurationSelector.java index ea6afa94b85..9a6e34cc7a1 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurationSelector.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurationSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -28,10 +28,12 @@ import org.springframework.context.annotation.AnnotationConfigUtils; * @since 3.1 * @see EnableAsync * @see ProxyAsyncConfiguration - * @see AnnotationConfigUtils#ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME */ public class AsyncConfigurationSelector extends AdviceModeImportSelector { + private static final String ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME = + "org.springframework.scheduling.aspectj.AspectJAsyncConfiguration"; + /** * {@inheritDoc} * @return {@link ProxyAsyncConfiguration} or {@code AspectJAsyncConfiguration} for @@ -43,7 +45,7 @@ public class AsyncConfigurationSelector extends AdviceModeImportSelector