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 convenient method to construct ParameterizedTypeReference from Type [SPR-16054] #20603

spring-issuemaster opened this issue Oct 7, 2017 · 0 comments


None yet
2 participants
Copy link

commented Oct 7, 2017

Yanming Zhou opened SPR-16054 and commented

I am implementing MethodInterceptor to translate method call to rest api call, so I need translate method.getGenericReturnType() to ParameterizedTypeReference for ResponseEntity, Here is my hack:

new ParameterizedTypeReference<Object>() {
     public Type getType() {
          return method.getGenericReturnType();

I wish spring provide such as:

public static ParameterizedTypeReference<?> from(Type type){
     return new ParameterizedTypeReference<Object>() {
          public Type getType() {
               return type;

Backported to: 4.3.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.