Skip to content

@ComponentScan does not work when referenced from XML config [SPR-7979] #12634

@spring-projects-issues

Description

@spring-projects-issues

Stepan Koltsov opened SPR-7979 and commented

Have simple configuration:

public abstract class Aaaaa { }

public class Bbbbb extends Aaaaa { }

@Configuration
@ComponentScan(
basePackages="com.mycompany",
useDefaultFilters=false,
includeFilters={
@ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=Aaaaa.class)
}
)public class Conf {

@Autowired
private Bbbbb bbbbb;

}

when loaded with

new AnnotationConfigApplicationContext(Conf.class)

works fine, however, when loaded with XML config that references Conf.class:

<beans>
<bean class="com.mycompany.Conf"/>
</beans>

new ClassPathXmlApplicationContext("classpath:com/mycompany/conf.xml");

it fails with exception: cannot autowire Conf.bbbbb field. Full stack trace: https://gist.github.com/835493 .


Affects: 3.1 M1

Attachments:

Issue Links:

Referenced from: commits d9f7fdd

1 votes, 0 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions