I have a class like that:
public class Wrapper { private String message; private T data; public String getMessage() { return message; }
Do not use generics with RestTemplate. Wrap request and response object with wrapper object that will hide the generics.