-1
In einer Federverschluß (1.4.1) Anwendung, ich versuche, eine Rest-Vorlage in diesen threadVerbrauchen einen Dienst mit restTemplate
@GetMapping(value = "/visits")
public ResponseEntity<CustomPageImpl<VisitDto>> getVisits(Pageable pageRequest) {
return restTemplate.getForEntity("", new TypeReference<CustomPageImpl<VisitDto>>() {});
}
wie die Antwort von Ali Dehghani zu konsumieren, erstelle ich ein CustomPageImpl
über TypeReference, importieren Sie com.fasterxml.jackson.core.type.TypeReference;
bekomme ich diese Nachricht
no suitable method found for getForEntity(String,<anonymous TypeReference<CustomPageImpl<VisitDto>>>)
method RestTemplate.<T#1>getForEntity(String,Class<T#1>,Object...) is not applicable
(cannot infer type-variable(s) T#1
(argument mismatch; <anonymous TypeReference<CustomPageImpl<VisitDto>>> cannot be converted to Class<T#1>))
method RestTemplate.<T#2>getForEntity(String,Class<T#2>,Map<String,?>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
method RestTemplate.<T#3>getForEntity(URI,Class<T#3>) is not applicable
(cannot infer type-variable(s) T#3
(argument mismatch; String cannot be converted to URI))
where T#1,T#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1>getForEntity(String,Class<T#1>,Object...)
T#2 extends Object declared in method <T#2>getForEntity(String,Class<T#2>,Map<String,?>)
T#3 extends Object declared in method <T#3>getForEntity(URI,Class<T#3>)
Mit
ResponseEntity<CustomPageImpl<VisitDto>> response = restTemplate.getForEntity(URI.create("url"), new TypeReference<ResponseEntity<CustomPageImpl<VisitDto>>>() {});
gleichen Fehler
Scheinen URI javax.net, analysieren nicht existieren, es ist Parser und es ist privat, so ist es create ... aber bekomme denselben Fehler –