Auto-configured ConcurrentPulsarListenerContainerFactory and PulsarConsumerFactory cannot be injected into injection points with specific generic type information#39308
Conversation
…ect for generic types
onobc
left a comment
There was a problem hiding this comment.
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
PulsarConsumerFactorynorConcurrentPulsarListenerContainerFactorywhere the former is blocking creating custom typed consumers.@onobc you probably have an opinion on this.