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

spring-projects-issues opened this issue Mar 22, 2018 · 1 comment
in: core status: backported type: enhancement


Copy link

spring-projects-issues commented Mar 22, 2018

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.


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.


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

Copy link
Collaborator Author

spring-projects-issues commented Mar 23, 2018

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 type: enhancement in: core 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
in: core status: backported type: enhancement
None yet

No branches or pull requests

2 participants