Generic type resolve broken after migrate from 3.4.2 to 3.4.3 #34520
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged or decided on
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 implements Serializable {
private static final long serialVersionUID = 1L;
}
interface UpdateableController<T extends Core<?>> {
}
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 {
private String fooName;
}
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.
demo.zip
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.
The text was updated successfully, but these errors were encountered: