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

When @DependsOn throws a NoSuchBeanDefinitionException it should include the dependent bean for clarity [SPR-16628] #21169

Closed
spring-projects-issues opened this issue Mar 22, 2018 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Kyle Anderson opened SPR-16628 and commented

When a bean annotated with @DependsOn references a bean name that doesn't exist, a NoSuchBeanDefinitionException is thrown.

Example:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'myMissingBean' available

I think this exception can be improved to contain information pertaining to the bean that was annotated with @DependsOn.

Example:

org.springframework.beans.factory.NoSuchBeanDefinitionException: 'com.example.MyBean' depends on a bean named 'myMissingBean' but it wasn't available

This would add a little extra clarity and traceability.


Affects: 4.3.14, 5.0.4

Reference URL: #1751

Backported to: 4.3.15

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good point! We're wrapping such a depends-on NoSuchBeanDefinitionException in a BeanCreationException for the dependent bean now, like we do for circular dependencies and also for injected dependencies already.

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement 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 5.0.5 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) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants