Skip to content
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

Closed

Conversation

jonas-grgt
Copy link
Contributor

@jonas-grgt jonas-grgt commented Jan 25, 2024

It is not possible to inject a specifically typed PulsarConsumerFactory nor ConcurrentPulsarListenerContainerFactory where the former is blocking creating custom typed consumers.
@onobc you probably have an opinion on this.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 25, 2024
Copy link
Contributor

@onobc onobc left a 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

@philwebb
Copy link
Member

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.

It is not possible to inject a specifically typed PulsarConsumerFactory

@jonasgeiregat It would be useful to see a sample or test that shows the failure with the current arrangement.

@jonas-grgt
Copy link
Contributor Author

I have added a test that should prove the failure. Simply changing <?> back to will trigger an injection error.

@wilkinsona wilkinsona changed the title fix(spring-boot-autoconfigure): Pulsar beans favor wildcards over Object for generic types Auto-configured ConcurrentPulsarListenerContainerFactory and PulsarConsumerFactory cannot be injected into injection points with specific generic type information Jan 30, 2024
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 30, 2024
@wilkinsona wilkinsona added this to the 3.2.x milestone Jan 30, 2024
@mhalbritter mhalbritter self-assigned this Jan 31, 2024
mhalbritter pushed a commit that referenced this pull request Jan 31, 2024
mhalbritter added a commit that referenced this pull request Jan 31, 2024
@mhalbritter
Copy link
Contributor

Thank you!

@mhalbritter mhalbritter modified the milestones: 3.2.x, 3.2.3 Jan 31, 2024
@jonas-grgt jonas-grgt deleted the pulsar-autoconf-generics branch February 1, 2024 15:38
@jonas-grgt jonas-grgt restored the pulsar-autoconf-generics branch February 1, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants