-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Add ConditionalOnBean support for generic bean argument types #29500
base: main
Are you sure you want to change the base?
Add ConditionalOnBean support for generic bean argument types #29500
Conversation
Thanks very much for the pull-request @VladislavSevruk. We discussed this today on our team call and we'd like to try and remove the If you're interested in updating your pull-request in that direction, that would be great but please be aware that we're currently focusing on some Spring Boot 3.0 issues and this one is in the "general backlog" so we might not be able to review and merge things all that quickly. No worries if you don't want to spend any additional time on this. We'll leave this issue open and mark it for |
Thank you for feedback @philwebb. I've updated code to auto-detect type arguments for generics from method return type. |
@VladislavSevruk yes please. We really want to support that mode only for the return type. |
Thanks a lot for the follow-up @VladislavSevruk. When merging this, we probably want to restore the existing tests using |
@snicoll tests with |
Any updates on when this PR will be merged? Will it affect older versions of Spring Boot (pre 3.x) or is it just for 3.x? |
@mitasov-ra The issue remains in the general backlog so things haven't changed since this comment. We consider the change to be an enhancement so it will only be made in a new minor (or major) release and won't affect older versions of Boot. |
Is this possible at all today? E.g., taking the example:
Is it possible to achieve this with the current
|
Add generic bean support using
@ConditionalOnBean
and@ConditionalOnMissingBean
annotations as described in #28845. Added two method to annotations:typeArguments
andtypeArgumentNames
for classes and class names respectively.Usage example: