-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed as not planned
Closed as not planned
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another
Description
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 org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1509)
...
Affects: 5.0.7
Reference URL: spring-projects/spring-boot#13531
Issue Links:
- Null bean value exception message confusing [SPR-16961] #21499 Null bean value exception message confusing
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another