Client:
ParameterizedTypeReference<PagedResources<Pass>> responseType =
new ParameterizedTypeReference<PagedResources<Pass>>() {};
PagedResources<Pass> passes =restTemplate.exchange(uri, HttpMethod.GET, null, responseType).getBody();
Server:
@RepositoryRestResource(collectionResourceRel = "pass", path = "pass")
public interface PassRepository extends JpaRepository<Pass,String> {
List<Pass> findByCarPlate(@Param("carPlate")String carPlate);
}
The data can be obtained normally by inputting URI on the web page, but the result is empty every time. Does anyone know how to solve it?
There is no problem in obtaining a single object, but there is a problem with the data set
Let me answer it myself, it’s still a problem with RestTemplate configuration.
Answer on stackoverflow
PagedResources does not have the _embedded attribute, resulting in the inability to obtain content.
This configuration seems to eliminate the function of parsing failure if the fields do not match, similar to @JsonIgnoreProperties.
I don’t know if I understand it correctly. I hope someone who understands can explain it.