RestTemplate PATCH request

后端 未结 5 1213
旧巷少年郎
旧巷少年郎 2020-12-13 17:48

I have the following definition for PersonDTO:

public class PersonDTO
{
    private String id
    private String firstName;
    private String lastName;
             


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 18:46

    For cases where RestTemplate is built from a RestTemplateBuilder, constructor for the custom RestClient can be written as,

    public PersonRestClient(RestTemplateBuilder restTemplateBuilder) {
      this.restTemplate = restTemplateBuilder.requestFactory(new HttpComponentsClientHttpRequestFactory()).build();
    }
    

    Also, the org.apache.httpcomponents.httpclient dependency needs to added to pom.

提交回复
热议问题