-1

Suppose instead of MediaEntry, I want too add a generic object type. Because MediaEntry could be a different class reside in different project and I cant use that object dependency in my code. How could I invoke exchange for such situation?

ResponseEntity<MediaEntry> result = getRestTemplate().exchange(uri, HttpMethod.POST, httpEntity,
                    new ParameterizedTypeReference<MediaEntry>() {
                    }, userId);
Harshana
  • 7,297
  • 25
  • 99
  • 173
  • Maybe in [this](https://stackoverflow.com/questions/36915823/spring-resttemplate-and-generic-types-parameterizedtypereference-collections-lik) way? – m4gic Dec 03 '18 at 12:39
  • Welcome, to improve your experience on Stack Overflow please read [how to ask](https://stackoverflow.com/help/how-to-ask) an [On Topic question](https://stackoverflow.com/help/on-topic), and the [Question Check list](https://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist) and [the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and if not already done, [take the tour](https://stackoverflow.com/tour). – Bsquare ℬℬ Dec 03 '18 at 13:30

1 Answers1

-1

can use String

ResponseEntity<String> result = getRestTemplate().exchange(uri, HttpMethod.POST, httpEntity,
                    new ParameterizedTypeReference<String>() {
                    }, userId);
Harshana
  • 7,297
  • 25
  • 99
  • 173