T A*_*nna 3 java post resttemplate spring-boot
我需要调用另一个api,并且尝试使用postForEntity,如下所示:
restTemplate.postForEntity(postUrl, request, responseType)
Run Code Online (Sandbox Code Playgroud)
现在,我正在调用的api返回的是特定类型的对象,比方说CustomerDto。但是我对此对象不感兴趣。我只想发布,不希望任何回报,所以我不想在应用程序中创建这个CustomerDto类。因此,对于这种情况,在上面的语句中,我应该用responseType代替什么。如果我想要返回的对象,在responseType的情况下,我会给出CustomerDto.class,但是我什么也不想得到,那么我该怎么办?
您可以使用postForLocation代替postForEntity。
restTemplate.postForLocation(postUrl, request)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1945 次 |
| 最近记录: |