After migrate spring from 3.4.2 to 3.4.3 the app is unable to resolve generics.
I have a base structure like that:
`
public abstract class Core
interface UpdateableController<T extends Core<?>> {
@PatchMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public default <E extends Serializable> ResponseEntity<Void> update(@PathVariable E id, @RequestBody T dto, BindingResult bindingResult) {
...
}
}
interface CrudController<T extends Core<?>> extends UpdateableController
} `
All my controllers inherits from CrudController or other base interface (UpdateableController, InsertableController...), for example:
`
public class Foo extends Core
interface FooController extends CrudController
}
@RestController @RequestMapping("/foo") class FooControllerImpl implements FooController { ... } `
In the previous version the Foo type was resolved and injected to the controller, but after the upgrade the parameter is resolved like Core<?> instead of "Foo".
In the image
ResolvableType.forVariableBounds(typeVariable); is resolving with the generic instead of go to the parent interface to lookup the generic like before.
In the demo zip you can run the code and use the next curl command to test.
curl --location --request PATCH 'http://localhost:8080/foo/1' \ --header 'Content-Type: application/json' \ --data '{ "fooName": "Hello!" }'
If you downgrade in the pom to 3.4.2 you can see that the request is resolved correctly.
Comment From: jhoeller
This looks like a duplicate of #34504. Please try the latest Spring Framework 6.2.4 snapshot and see whether it works for you there...