Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Jun 1, 2010 · 3 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues
Copy link
Collaborator Author

Tomasz Bech commented

Probably in
DefaultSingletonBeanRegistry.java
public void registerDependentBean(String beanName, String dependentBeanName) {

also aliases should be registered

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch! Indeed, we need to resolve the specified bean name to the canonical name before we proceed in registerDependentBean.

Fixed for 3.0.3 - will be available in tonight's 3.0.3 snapshot. Feel free to give it an early try...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Tomasz Bech commented

would it possible to backport patch to 2.5.x tree?
At this stage of our project, I cannot upgrade to Spring 3.x.

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants