Skip to content

spring context wrongly created when using aliases [SPR-7254] #11913

Closed
@spring-projects-issues

Description

@spring-projects-issues

Tomasz Bech opened SPR-7254 and commented

Under some conditions, spring context is wrongly created.
Problem appears when:

  • there are beans/code which requires eager creation of the beans (autowiring by type or getBeansByType());
  • there are instances of FactoryBean-s;
  • some of the beans during eager creation cannot be instanciated;
  • aliases are used;

The original problem happened with cxf library and thousands of objects in spring context. Out of that, hopefully, I was able to build the testcase. It is attached - as separate project (maven).
As it is, it fails with NullPointerException - this means that one of the BeanK has 'wrongly created object of type BeanW' injected.
When you get rid of beanWAlias from the test.xml - test passes.

Look on BeanD - at first time it throws exception during construction - it leads to destorying of eagerly created singletons - but the destruction is not correct/full - beanK remains in the context. It is because 'alias' is used.


Affects: 2.5.6

Attachments:

Referenced from: commits de866a0

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions