Skip to content

AnnotationConfigApplicationContext doesn't process @Configuration classes scanned by component scan. [SPR-10984] #15612

Closed
@spring-projects-issues

Description

@spring-projects-issues

Andruschuk Borislav opened SPR-10984 and commented

Let's consider the following case:

@Configuration
@ImportResource("some.xml")
public class SomeClass { ... }

in some.xml:

<context:component-scan base-package="com.somepackage"/>

in com.somepackage there's class:

@Configuration
public class OtherClass {

   @Bean(name="SomeNewBean")
   public Object getSomeBean(){ ... }
}

If AnnotationConfigApplicationContext is used against first configuration class only (SomeClass) I assume last configuration class (OtherClass) should be processed as well. However the bean defined inside last configuration class doesn't exist in application context after initialization (refresh).

Some investigation showed that ConfigurationClassPostProcessor is not invoked for OtherClass therefore any annotations inside class never get processed.


Affects: 3.0 GA

Issue Links:

3 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions