@ConditionalOnMissingBean now also checks beans available via FactoryBeans#355
@ConditionalOnMissingBean now also checks beans available via FactoryBeans#355jkubrynski wants to merge 1 commit intospring-projects:masterfrom jkubrynski:master
Conversation
|
Thanks for the pull request and for raising #352. I have made a few tweaks [1] to also deal with the XML test which was previously not failing because it didn't include the I think your approach is generally sensible but I would like @dsyer to review the updated patch to ensure there aren't any unexpected side-effects. I am also wondering if this is something that the core Spring Framework should deal with directly, rather than something that is specific to Spring Boot? Perhaps this is something we should push upstream? |
|
Thanks for tweaks. I think you're probably right and this is something that should be pushed to Spring Core. In fact it'll be probably a bigger change (due to there will be no more need to instantiate beans, so both boolean parametrs used to tune resolving won't be longer needed) - I'll take a look at this. |
|
Merged, thanks. Definitely this code should be in |
Update OnBeanCondition to attempt to consider FactoryBean classes for bean type matches. To ensure early instantiation does not occur, the object type from the FactoryBean is deduced by resolving generics on the declaration. Fixes spring-projectsgh-355
Fixed approach from previous pull request to validate if there are beans related to
@ConditionalOnMissingBeanavailable viaBeanFactoryWorks fully on generics, without instantiating any bean