Autowire contract is not honored in cases where FactoryBean or @Bean return null [SPR-15829] #20384
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Oleg Zhurakousky opened SPR-15829 and commented
Configuration below reproduces the issue
The bottom line is that the above does NOT result in “Field foo in MyApplication required a bean of type 'FooStrategy' that could not be found.” And instead it results in NPE. But the NPE is not happening during AC initialization, rather during the invocation of any callback to 'foo'.
Regardless of the reason to return null from the factory method, the main issue IMHO is that
@Autowire
contract is not followed for this type of scenario.Affects: 5.0 RC3
Issue Links:
@Lazy
collection of optional elements should not crash when no candidates are foundReferenced from: commits 30bd582, b94302b
The text was updated successfully, but these errors were encountered: