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

Add support for resolving multiple bounds in type variables #22902

Closed
d-roenko opened this issue May 6, 2019 · 2 comments
Closed

Add support for resolving multiple bounds in type variables #22902

d-roenko opened this issue May 6, 2019 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@d-roenko
Copy link

d-roenko commented May 6, 2019

Affects: 5.1.6 , and I believe any previous

Autowired list of beans with multiple bounds generics may result in ClassCastException in the runtime due to org.springframework.core.ResolvableType::resolveBounds taking only the first (return bounds[0]) bound into the account.

Here is the minimal reproducible example: https://github.com/d-roenko/multiple-bounds-generics/blob/03a9aad3040d69c3073510664dfb6a9bdc007cdb/src/main/java/com/example/demo/DemoApplication.java


@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 6, 2019
@jhoeller jhoeller self-assigned this May 6, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 10, 2021
@snicoll snicoll changed the title Wrong autowiring by type into collection-typed bean with multiple bounds generics Add support for resolving multiple bounds generics Nov 14, 2023
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 14, 2023
@snicoll snicoll added this to the 6.x Backlog milestone Nov 14, 2023
@snicoll
Copy link
Member

snicoll commented Nov 14, 2023

Indeed, ResolvableType does not support mutiple bounds generics at this time so we'll have to investigate how we can support that.

@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.2.x Dec 18, 2023
@jhoeller jhoeller removed their assignment Dec 22, 2023
@jhoeller jhoeller self-assigned this Mar 1, 2024
@jhoeller jhoeller modified the milestones: 6.2.x, 6.2.0-M1 Mar 1, 2024
@jhoeller jhoeller changed the title Add support for resolving multiple bounds generics Add support for resolving multiple bounds in type variables Mar 1, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Mar 2, 2024

This turns out to be rather involved but go nicely together with #30079 and #20727, even addressing the regressions in #32327 in a cleaner fashion now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants