Skip to content

@ConditionalOnMissingBean now also checks beans available via FactoryBeans #355

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

Closed
wants to merge 1 commit into from

Conversation

jkubrynski
Copy link
Contributor

Fixed approach from previous pull request to validate if there are beans related to @ConditionalOnMissingBean available via BeanFactory

Works fully on generics, without instantiating any bean

@philwebb
Copy link
Member

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 @Conditional bean.

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?

[1] https://github.com/philwebb/spring-boot/tree/gh-355

@philwebb philwebb self-assigned this Feb 15, 2014
@jkubrynski
Copy link
Contributor Author

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.

@dsyer dsyer closed this in 5d591ed Feb 17, 2014
@dsyer
Copy link
Member

dsyer commented Feb 17, 2014

Merged, thanks. Definitely this code should be in BeanFactoryUtils (cc@ @jhoeller).

@philwebb philwebb modified the milestone: 1.0.0.RC4 Feb 25, 2014
gigfork pushed a commit to boostrack/spring-boot that referenced this pull request Apr 21, 2014
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants