From 6263c9abf950692c15b5bc5edd854b3949b10b19 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Fri, 25 May 2012 17:30:45 +0300 Subject: [PATCH] Fix package cycle in @EnableSpringConfigured @EnableSpringConfigured and its @Import'ed SpringConfiguredConfiguration @Configuration class inadvertently established a package cycle between beans.factory.aspectj and context.annotation due to SpringConfiguredConfiguration's dependency on annotations such as @Configuration, @Bean and @Role. This commit fixes this architecture bug by moving @EnableSpringConfigured and SpringConfiguredConfiguration from the beans.factory.aspectj package to the context.annotation package where they belong. This change is assumed to be very low impact as @EnableSpringConfigured was introduced in 3.1.0 and relocation is happening as quickly as possible in 3.1.2. @EnableSpringConfigured is assumed to be infrequently used at this point, and for those that are the migration path is straightforward. When upgrading from Spring 3.1.0 or 3.1.1, update import statements in any affected @Configuration classes to reflect the new packaging. Backporter's note: this change causes Bundlor warnings in org.springframework.aspect as its manifest now "imports and exports the package org.springframework.context.annotation". To 'solve' this problem, `fail.on.warnings=false` has been added to build.properties. This means that future Bundlor-based warnings may go unnoticed. Issue: SPR-9442 Backport-Issue: SPR-9441 Backport-Commit: 5327a7a37d25b67ee2ae7d1ead2a3db6847767c0 --- build.properties | 3 +++ .../annotation}/EnableSpringConfigured.java | 18 ++++++++++-------- .../SpringConfiguredConfiguration.java | 5 +++-- .../AnnotationBeanConfigurerTests.java | 11 +++++------ 4 files changed, 21 insertions(+), 16 deletions(-) rename org.springframework.aspects/src/main/java/org/springframework/{beans/factory/aspectj => context/annotation}/EnableSpringConfigured.java (69%) rename org.springframework.aspects/src/main/java/org/springframework/{beans/factory/aspectj => context/annotation}/SpringConfiguredConfiguration.java (90%) rename org.springframework.aspects/src/test/java/org/springframework/{beans/factory/aspectj => context/annotation}/AnnotationBeanConfigurerTests.java (73%) diff --git a/build.properties b/build.properties index c02cd8ed995..a9c314a521d 100644 --- a/build.properties +++ b/build.properties @@ -27,3 +27,6 @@ aj.osgi.range="[1.6.8, 2.0.0)" ## For trunk development / ci builds release.type=integration build.stamp=BUILD-SNAPSHOT + +#bundlor +fail.on.warnings=false diff --git a/org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/EnableSpringConfigured.java b/org.springframework.aspects/src/main/java/org/springframework/context/annotation/EnableSpringConfigured.java similarity index 69% rename from org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/EnableSpringConfigured.java rename to org.springframework.aspects/src/main/java/org/springframework/context/annotation/EnableSpringConfigured.java index 68b7aab4a77..0b49f7c5b74 100644 --- a/org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/EnableSpringConfigured.java +++ b/org.springframework.aspects/src/main/java/org/springframework/context/annotation/EnableSpringConfigured.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.beans.factory.aspectj; +package org.springframework.context.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -25,14 +25,16 @@ import java.lang.annotation.Target; import org.springframework.context.annotation.Import; /** - * Signals the current application context to apply dependency injection to non-managed - * classes that are instantiated outside of the Spring bean factory (typically classes - * annotated with the @{@link org.springframework.beans.factory.annotation.Configurable + * Signals the current application context to apply dependency injection to + * non-managed classes that are instantiated outside of the Spring bean factory + * (typically classes annotated with the @ + * {@link org.springframework.beans.factory.annotation.Configurable * Configurable} annotation). * - *

Similar to functionality found in Spring's {@code } XML - * element. Often used in conjunction with {@link - * org.springframework.context.annotation.EnableLoadTimeWeaving @EnableLoadTimeWeaving}. + *

Similar to functionality found in Spring's + * {@code } XML element. Often used in conjunction + * with {@link org.springframework.context.annotation.EnableLoadTimeWeaving + * @EnableLoadTimeWeaving}. * * @author Chris Beams * @since 3.1 diff --git a/org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/SpringConfiguredConfiguration.java b/org.springframework.aspects/src/main/java/org/springframework/context/annotation/SpringConfiguredConfiguration.java similarity index 90% rename from org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/SpringConfiguredConfiguration.java rename to org.springframework.aspects/src/main/java/org/springframework/context/annotation/SpringConfiguredConfiguration.java index 2c34e11ab2a..4f1fe7d883e 100644 --- a/org.springframework.aspects/src/main/java/org/springframework/beans/factory/aspectj/SpringConfiguredConfiguration.java +++ b/org.springframework.aspects/src/main/java/org/springframework/context/annotation/SpringConfiguredConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 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. @@ -14,8 +14,9 @@ * limitations under the License. */ -package org.springframework.beans.factory.aspectj; +package org.springframework.context.annotation; +import org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/org.springframework.aspects/src/test/java/org/springframework/beans/factory/aspectj/AnnotationBeanConfigurerTests.java b/org.springframework.aspects/src/test/java/org/springframework/context/annotation/AnnotationBeanConfigurerTests.java similarity index 73% rename from org.springframework.aspects/src/test/java/org/springframework/beans/factory/aspectj/AnnotationBeanConfigurerTests.java rename to org.springframework.aspects/src/test/java/org/springframework/context/annotation/AnnotationBeanConfigurerTests.java index 26e4ac0a9b1..9165b89cb29 100644 --- a/org.springframework.aspects/src/test/java/org/springframework/beans/factory/aspectj/AnnotationBeanConfigurerTests.java +++ b/org.springframework.aspects/src/test/java/org/springframework/context/annotation/AnnotationBeanConfigurerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2012 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. @@ -14,16 +14,15 @@ * limitations under the License. */ -package org.springframework.beans.factory.aspectj; +package org.springframework.context.annotation; +import org.springframework.beans.factory.aspectj.AbstractBeanConfigurerTests; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; /** * Tests that @EnableSpringConfigured properly registers an - * {@link AnnotationBeanConfigurerAspect}, just as does {@code } + * {@link org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect}, just + * as does {@code } * * @author Chris Beams * @since 3.1