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

Odd behaviour with null bean instance when an alternative autowire candidate is available [SPR-16960] #21498

spring-projects-issues opened this issue Jun 20, 2018 · 0 comments
in: core status: waiting-for-triage


Copy link

@spring-projects-issues spring-projects-issues commented Jun 20, 2018

Dave Syer opened SPR-16960 and commented

Since Spring 5.0 a @Bean can return null and the effect is to leave the bean definition in the registry, but make the value not autowirable. However, if there is another bean of the same type that is not null, it does not become autowirable. Probably it should? The exception from Spring doesn't mention the existence of either bean (the null or the not null one):


norg.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at

Affects: 5.0.7

Reference URL: spring-projects/spring-boot#13531

Issue Links:

  • #21499 Null bean value exception message confusing
@spring-projects-issues spring-projects-issues added type: bug status: waiting-for-triage in: core and removed type: bug labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core status: waiting-for-triage
None yet

No branches or pull requests

1 participant