diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java index ff27755c049..08e63107533 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ComponentScanAnnotationIntegrationTests.java @@ -109,7 +109,7 @@ public class ComponentScanAnnotationIntegrationTests { } @Test - public void viaContextRegistration_WithLocallyDeclaredComposedAnnotation() { + public void viaContextRegistration_WithComposedAnnotation() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(ComposedAnnotationConfig.class); ctx.refresh(); @@ -122,19 +122,6 @@ public class ComponentScanAnnotationIntegrationTests { ctx.containsBean("simpleComponent"), is(true)); } - @Test - public void viaContextRegistration_WithExternallyDeclaredComposedAnnotation() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - ctx.register(org.springframework.context.annotation.componentscan.meta.ComposedAnnotationConfig.class); - ctx.refresh(); - ctx.getBean(org.springframework.context.annotation.componentscan.meta.ComposedAnnotationConfig.class); - ctx.getBean(SimpleComponent.class); - assertThat("config class bean not found", ctx.containsBeanDefinition("composedAnnotationConfig"), is(true)); - assertThat("@ComponentScan annotated @Configuration class registered directly against " - + "AnnotationConfigApplicationContext did not trigger component scanning as expected", - ctx.containsBean("simpleComponent"), is(true)); - } - @Test public void viaBeanRegistration() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java index fa378bf2c2b..59600932665 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java @@ -51,6 +51,7 @@ public class ConfigurationClassPostProcessorTests { private DefaultListableBeanFactory beanFactory; + @Before public void setUp() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); @@ -85,8 +86,8 @@ public class ConfigurationClassPostProcessorTests { */ @Test public void alreadyLoadedConfigurationClasses() { - beanFactory.registerBeanDefinition("unloadedConfig", - new RootBeanDefinition(UnloadedConfig.class.getName(), null, null)); + beanFactory.registerBeanDefinition("unloadedConfig", new RootBeanDefinition(UnloadedConfig.class.getName(), + null, null)); beanFactory.registerBeanDefinition("loadedConfig", new RootBeanDefinition(LoadedConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); @@ -111,55 +112,75 @@ public class ConfigurationClassPostProcessorTests { } @Test - public void postProcessorWorksWithLocallyDeclaredComposedConfiguration() { - beanFactory.registerBeanDefinition("config", new RootBeanDefinition(ComposedConfigurationClass.class)); - ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); - pp.setEnvironment(new StandardEnvironment()); - pp.postProcessBeanFactory(beanFactory); - SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); - assertNotNull(simpleComponent); + public void postProcessorWorksWithComposedConfigurationUsingReflection() { + RootBeanDefinition beanDefinition = new RootBeanDefinition(ComposedConfigurationClass.class); + postProcessorWorksWithComposedConfiguration(beanDefinition); } @Test - public void postProcessorWorksWithLocallyDeclaredComposedComposedConfiguration() { - beanFactory.registerBeanDefinition("config", new RootBeanDefinition(ComposedComposedConfigurationClass.class)); - ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); - pp.setEnvironment(new StandardEnvironment()); - pp.postProcessBeanFactory(beanFactory); - SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); - assertNotNull(simpleComponent); + public void postProcessorWorksWithComposedConfigurationUsingAsm() { + RootBeanDefinition beanDefinition = new RootBeanDefinition(ComposedConfigurationClass.class.getName()); + postProcessorWorksWithComposedConfiguration(beanDefinition); } @Test - public void postProcessorWorksWithLocallyDeclaredMetaComponentScanConfiguration() { - beanFactory.registerBeanDefinition("config", new RootBeanDefinition(MetaComponentScanConfigurationClass.class)); - ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); - pp.setEnvironment(new StandardEnvironment()); - pp.postProcessBeanFactory(beanFactory); - SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); - assertNotNull(simpleComponent); + public void postProcessorWorksWithComposedConfigurationWithAttributeOverridesUsingReflection() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + ComposedConfigurationWithAttributeOverridesClass.class); + postProcessorWorksWithComposedConfigurationWithAttributeOverrides(beanDefinition); + } + + // TODO Remove expected exception when SPR-XXXXX is resolved. + @Test(expected = ConflictingBeanDefinitionException.class) + public void postProcessorWorksWithComposedConfigurationWithAttributeOverridesUsingAsm() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + ComposedConfigurationWithAttributeOverridesClass.class.getName()); + postProcessorWorksWithComposedConfigurationWithAttributeOverrides(beanDefinition); } @Test - public void postProcessorWorksWithLocallyDeclaredMetaComponentScanConfigurationSubclass() { - beanFactory.registerBeanDefinition("config", new RootBeanDefinition( - SubMetaComponentScanConfigurationClass.class)); - ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); - pp.setEnvironment(new StandardEnvironment()); - pp.postProcessBeanFactory(beanFactory); - SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); - assertNotNull(simpleComponent); + public void postProcessorWorksWithComposedComposedConfigurationWithAttributeOverridesUsingReflection() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + ComposedComposedConfigurationWithAttributeOverridesClass.class); + postProcessorWorksWithComposedComposedConfigurationWithAttributeOverrides(beanDefinition); + } + + // TODO Remove expected exception when SPR-XXXXX is resolved. + @Test(expected = ConflictingBeanDefinitionException.class) + public void postProcessorWorksWithComposedComposedConfigurationWithAttributeOverridesUsingAsm() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + ComposedComposedConfigurationWithAttributeOverridesClass.class.getName()); + postProcessorWorksWithComposedComposedConfigurationWithAttributeOverrides(beanDefinition); } @Test - public void postProcessorWorksWithExternallyDeclaredComposedAnnotation() { - beanFactory.registerBeanDefinition("config", new RootBeanDefinition( - org.springframework.context.annotation.componentscan.meta.ComposedAnnotationConfig.class)); - ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); - pp.setEnvironment(new StandardEnvironment()); - pp.postProcessBeanFactory(beanFactory); - SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); - assertNotNull(simpleComponent); + public void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesUsingReflection() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + MetaComponentScanConfigurationWithAttributeOverridesClass.class); + postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverrides(beanDefinition); + } + + // TODO Remove expected exception when SPR-XXXXX is resolved. + @Test(expected = ConflictingBeanDefinitionException.class) + public void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesUsingAsm() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + MetaComponentScanConfigurationWithAttributeOverridesClass.class.getName()); + postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverrides(beanDefinition); + } + + @Test + public void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesSubclassUsingReflection() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + SubMetaComponentScanConfigurationWithAttributeOverridesClass.class); + postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesSubclass(beanDefinition); + } + + // TODO Remove expected exception when SPR-XXXXX is resolved. + @Test(expected = ConflictingBeanDefinitionException.class) + public void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesSubclassUsingAsm() { + RootBeanDefinition beanDefinition = new RootBeanDefinition( + SubMetaComponentScanConfigurationWithAttributeOverridesClass.class.getName()); + postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesSubclass(beanDefinition); } @Test @@ -191,7 +212,8 @@ public class ConfigurationClassPostProcessorTests { public void postProcessorDoesNotOverrideRegularBeanDefinitionsEvenWithScopedProxy() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); - BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy(new BeanDefinitionHolder(rbd, "bar"), beanFactory, true); + BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy(new BeanDefinitionHolder(rbd, "bar"), + beanFactory, true); beanFactory.registerBeanDefinition("bar", proxied.getBeanDefinition()); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); @@ -278,7 +300,8 @@ public class ConfigurationClassPostProcessorTests { RootBeanDefinition bd = new RootBeanDefinition(RepositoryInjectionBean.class); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); beanFactory.registerBeanDefinition("annotatedBean", bd); - beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(ScopedProxyRepositoryConfiguration.class)); + beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition( + ScopedProxyRepositoryConfiguration.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.freezeConfiguration(); @@ -313,7 +336,8 @@ public class ConfigurationClassPostProcessorTests { RootBeanDefinition bd = new RootBeanDefinition(RepositoryFactoryBeanInjectionBean.class); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); beanFactory.registerBeanDefinition("annotatedBean", bd); - beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(RepositoryFactoryBeanConfiguration.class)); + beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition( + RepositoryFactoryBeanConfiguration.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.preInstantiateSingletons(); @@ -344,7 +368,8 @@ public class ConfigurationClassPostProcessorTests { @Test public void genericsBasedInjectionWithWildcardWithExtendsMatch() { - beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(WildcardWithExtendsConfiguration.class)); + beanFactory.registerBeanDefinition("configClass", + new RootBeanDefinition(WildcardWithExtendsConfiguration.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); @@ -353,84 +378,133 @@ public class ConfigurationClassPostProcessorTests { @Test public void genericsBasedInjectionWithWildcardWithGenericExtendsMatch() { - beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(WildcardWithGenericExtendsConfiguration.class)); + beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition( + WildcardWithGenericExtendsConfiguration.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); assertSame(beanFactory.getBean("genericRepo"), beanFactory.getBean("repoConsumer")); } + private void postProcessorWorksWithComposedConfiguration(RootBeanDefinition beanDefinition) { + beanFactory.registerBeanDefinition("config", beanDefinition); + ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); + pp.setEnvironment(new StandardEnvironment()); + pp.postProcessBeanFactory(beanFactory); + SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); + assertNotNull(simpleComponent); + } + + private void postProcessorWorksWithComposedConfigurationWithAttributeOverrides(RootBeanDefinition beanDefinition) { + beanFactory.registerBeanDefinition("config", beanDefinition); + ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); + pp.setEnvironment(new StandardEnvironment()); + pp.postProcessBeanFactory(beanFactory); + SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); + assertNotNull(simpleComponent); + } + + private void postProcessorWorksWithComposedComposedConfigurationWithAttributeOverrides( + RootBeanDefinition beanDefinition) { + beanFactory.registerBeanDefinition("config", beanDefinition); + ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); + pp.setEnvironment(new StandardEnvironment()); + pp.postProcessBeanFactory(beanFactory); + SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); + assertNotNull(simpleComponent); + } + + private void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverrides( + RootBeanDefinition beanDefinition) { + beanFactory.registerBeanDefinition("config", beanDefinition); + ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); + pp.setEnvironment(new StandardEnvironment()); + pp.postProcessBeanFactory(beanFactory); + SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); + assertNotNull(simpleComponent); + } + + private void postProcessorWorksWithMetaComponentScanConfigurationWithAttributeOverridesSubclass( + RootBeanDefinition beanDefinition) { + beanFactory.registerBeanDefinition("config", beanDefinition); + ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); + pp.setEnvironment(new StandardEnvironment()); + pp.postProcessBeanFactory(beanFactory); + SimpleComponent simpleComponent = beanFactory.getBean(SimpleComponent.class); + assertNotNull(simpleComponent); + } + + + // ------------------------------------------------------------------------- @Configuration static class SingletonBeanConfig { - public @Bean Foo foo() { + public @Bean + Foo foo() { return new Foo(); } - public @Bean Bar bar() { + public @Bean + Bar bar() { return new Bar(foo()); } } - static class Foo { } - static class Bar { final Foo foo; + public Bar(Foo foo) { this.foo = foo; } } - @Configuration static class UnloadedConfig { - public @Bean Foo foo() { + public @Bean + Foo foo() { return new Foo(); } } - @Configuration static class LoadedConfig { - public @Bean Bar bar() { + public @Bean + Bar bar() { return new Bar(new Foo()); } } - public static class ScopedProxyConsumer { @Autowired public ITestBean testBean; } - @Configuration public static class ScopedProxyConfigurationClass { - @Bean @Lazy @Scope(proxyMode=ScopedProxyMode.INTERFACES) + @Bean + @Lazy + @Scope(proxyMode = ScopedProxyMode.INTERFACES) public ITestBean scopedClass() { return new TestBean(); } } - public static class Repository { } - public static class GenericRepository extends Repository { } - public static class RepositoryFactoryBean implements FactoryBean { @Override @@ -449,7 +523,6 @@ public class ConfigurationClassPostProcessorTests { } } - public static class RepositoryInjectionBean { @Autowired @@ -459,13 +532,13 @@ public class ConfigurationClassPostProcessorTests { public Repository integerRepository; } - @Configuration public static class RepositoryConfiguration { @Bean public Repository stringRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -476,6 +549,7 @@ public class ConfigurationClassPostProcessorTests { @Bean public Repository integerRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -486,6 +560,7 @@ public class ConfigurationClassPostProcessorTests { @Bean public Repository genericRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -494,13 +569,14 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class ScopedRepositoryConfiguration { - @Bean @Scope("prototype") + @Bean + @Scope("prototype") public Repository stringRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -508,9 +584,11 @@ public class ConfigurationClassPostProcessorTests { }; } - @Bean @Scope("prototype") + @Bean + @Scope("prototype") public Repository integerRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -518,10 +596,12 @@ public class ConfigurationClassPostProcessorTests { }; } - @Bean @Scope("prototype") + @Bean + @Scope("prototype") @SuppressWarnings("rawtypes") public Repository genericRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -530,13 +610,14 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class ScopedProxyRepositoryConfiguration { - @Bean @Scope(value="prototype", proxyMode=ScopedProxyMode.TARGET_CLASS) + @Bean + @Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) public Repository stringRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -544,9 +625,11 @@ public class ConfigurationClassPostProcessorTests { }; } - @Bean @Scope(value="prototype", proxyMode=ScopedProxyMode.TARGET_CLASS) + @Bean + @Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) public Repository integerRepo() { return new Repository() { + @Override public String toString() { return "Repository"; @@ -555,14 +638,12 @@ public class ConfigurationClassPostProcessorTests { } } - public static class SpecificRepositoryInjectionBean { @Autowired public GenericRepository genericRepository; } - @Configuration public static class SpecificRepositoryConfiguration { @@ -572,7 +653,6 @@ public class ConfigurationClassPostProcessorTests { } } - public static class RepositoryFactoryBeanInjectionBean { @Autowired @@ -587,7 +667,6 @@ public class ConfigurationClassPostProcessorTests { public RepositoryFactoryBean prefixQualifiedRepositoryFactoryBean; } - @Configuration public static class RepositoryFactoryBeanConfiguration { @@ -597,7 +676,6 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class RawMatchingConfiguration { @@ -613,7 +691,6 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class WildcardMatchingConfiguration { @@ -629,7 +706,6 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class WildcardWithExtendsConfiguration { @@ -649,7 +725,6 @@ public class ConfigurationClassPostProcessorTests { } } - @Configuration public static class WildcardWithGenericExtendsConfiguration { @@ -670,26 +745,39 @@ public class ConfigurationClassPostProcessorTests { } @Configuration - @ComponentScan + @ComponentScan(basePackages = "org.springframework.context.annotation.componentscan.simple") @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public static @interface ComposedConfiguration { - String[] basePackages() default {}; - } - - @ComposedConfiguration(basePackages = "org.springframework.context.annotation.componentscan.simple") - public static class ComposedConfigurationClass { } @ComposedConfiguration + public static class ComposedConfigurationClass { + } + + @Configuration + @ComponentScan @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) - public static @interface ComposedComposedConfiguration { + public static @interface ComposedConfigurationWithAttributeOverrides { + String[] basePackages() default {}; } - @ComposedComposedConfiguration(basePackages = "org.springframework.context.annotation.componentscan.simple") - public static class ComposedComposedConfigurationClass { + @ComposedConfigurationWithAttributeOverrides(basePackages = "org.springframework.context.annotation.componentscan.simple") + public static class ComposedConfigurationWithAttributeOverridesClass { + } + + @ComposedConfigurationWithAttributeOverrides + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + public static @interface ComposedComposedConfigurationWithAttributeOverrides { + + String[] basePackages() default {}; + } + + @ComposedComposedConfigurationWithAttributeOverrides(basePackages = "org.springframework.context.annotation.componentscan.simple") + public static class ComposedComposedConfigurationWithAttributeOverridesClass { } @ComponentScan @@ -702,16 +790,18 @@ public class ConfigurationClassPostProcessorTests { @Configuration @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) - public static @interface MetaComponentScanConfiguration { + public static @interface MetaComponentScanConfigurationWithAttributeOverrides { + String[] basePackages() default {}; } - @MetaComponentScanConfiguration(basePackages = "org.springframework.context.annotation.componentscan.simple") - public static class MetaComponentScanConfigurationClass { + @MetaComponentScanConfigurationWithAttributeOverrides(basePackages = "org.springframework.context.annotation.componentscan.simple") + public static class MetaComponentScanConfigurationWithAttributeOverridesClass { } @Configuration - public static class SubMetaComponentScanConfigurationClass extends MetaComponentScanConfigurationClass { + public static class SubMetaComponentScanConfigurationWithAttributeOverridesClass extends + MetaComponentScanConfigurationWithAttributeOverridesClass { } } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedAnnotationConfig.java b/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedAnnotationConfig.java deleted file mode 100644 index 57a77ccab69..00000000000 --- a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedAnnotationConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.context.annotation.componentscan.meta; - -/** - * @author Sam Brannen - * @since 4.0.3 - */ -@ComposedConfiguration(basePackages = "org.springframework.context.annotation.componentscan.simple") -public class ComposedAnnotationConfig { - -} diff --git a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedConfiguration.java b/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedConfiguration.java deleted file mode 100644 index bdaedbcd8c7..00000000000 --- a/spring-context/src/test/java/org/springframework/context/annotation/componentscan/meta/ComposedConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.context.annotation.componentscan.meta; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * Composed annotation, combining {@link Configuration @Configuration} and - * {@link ComponentScan @ComponentScan}. - * - * @author Sam Brannen - * @since 4.0.3 - */ -@Configuration -@ComponentScan -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ComposedConfiguration { - String[] basePackages() default {}; -} diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java index f6f34008527..48d88752a03 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.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. @@ -43,6 +43,7 @@ import org.springframework.util.ReflectionUtils; * @author Chris Beams * @author Juergen Hoeller * @author Phillip Webb + * @author Sam Brannen * @since 3.1.1 */ abstract class AbstractRecursiveAnnotationVisitor extends AnnotationVisitor { @@ -279,7 +280,7 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib // otherwise, and don't want to mess with accessibility in a SecurityManager environment. if (Modifier.isPublic(annotation.annotationType().getModifiers())) { this.attributesMap.add(annotation.annotationType().getName(), - AnnotationUtils.getAnnotationAttributes(annotation, true, true)); + AnnotationUtils.getAnnotationAttributes(annotation, false, true)); for (Annotation metaMetaAnnotation : annotation.annotationType().getAnnotations()) { recursivelyCollectMetaAnnotations(visited, metaMetaAnnotation); }