OAuth2RestTemplate keycloakTemplate = new OAuth2RestTemplate(keycloak(), oauth2ClientContext);
keycloakTemplate.setRequestFactory(new OkHttp3ClientHttpRequestFactory(okHttpClient()));
我找到了
ClientHttpRequest request = createRequest(url,method) // in the RestTemplate;
我发现结果是SimpleBufferingClientHttpRequest
不是OkHttp3ClientHttpRequestFactory