-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Auto-configured ConcurrentPulsarListenerContainerFactory and PulsarConsumerFactory cannot be injected into injection points with specific generic type information #39308
Conversation
…ect for generic types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @jonasgeiregat .
These 2 beans were the only ones typed as Object
so this brings things into a consistent state. I am not sure why we had them typed as such, but will see if @philwebb can refresh my memory. Either way, they should be consistent w/ the other bean types.
My only suggestion is to add/adjust test for these 2 cases.
Disclaimer, I have a non-binding vote in Spring Boot project so will need to wait for one of the Boot team members to follow on w/ their review.
Thanks
...ure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarAutoConfiguration.java
Show resolved
Hide resolved
I'm not sure it was intentional. Despite many years of Java experience I still struggle with generics. Usually my default rule is wildcards on parameters and concrete types on return values so I probably just followed that.
@jonasgeiregat It would be useful to see a sample or test that shows the failure with the current arrangement. |
I have added a test that should prove the failure. Simply changing <?> back to will trigger an injection error. |
...ure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarAutoConfiguration.java
Show resolved
Hide resolved
Thank you! |
It is not possible to inject a specifically typed
PulsarConsumerFactory
norConcurrentPulsarListenerContainerFactory
where the former is blocking creating custom typed consumers.@onobc you probably have an opinion on this.