Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Subclass-resolved generic return type declarations for handler methods [SPR-16877] #21416
If you have a generic AbstractController that specifies a method with a
Due to this behavior it is impossible to use inheritance with generics for type dependent data formats such as CSV.
Provided data type: java.util.List<T>
Actual/Expected data type: java.util.List<MyDTO>
See the attached demo project for an easy way to reproduce.
There is a workaround for that though, override all the inherited methods in the SpecificController and just delegate to super.
However this is easy to forget, hard to spot and just adds plenty of noise to the controllers.
I haven't made any recent tests with Spring 4.x, but IIRC that version is also affected.
Referenced from: commits b915e42
Juergen Hoeller commented
We resolve the target type for
This will be available in the upcoming