I migrated to spring boot 3 and java 21. Since I have a patch rest call to make, i needed the dependency org.apache.httpcomponents.client5:httpclient5:5.2.2.
But with that dependency, I get a "java.lang.IllegalArgumentException: Invalid Proxy" if using org.springframework.web.client.RestTemplate with RequestEntity.get.
The patch call is working just fine with the same settings.
- Spring 3.1.6
- Java 21
Does have anyone an idea why this happens? I don't have a proxy. Do I have to define a default proxy?
Unfortunately, for this link: https://github.com/apache/httpcomponents-client/tree/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java I get 404. :-(
I tried using only apache dependencies without the resttemplate and get the same exception.
HttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(uri);
httpGet.setHeader(HttpHeaders.AUTHORIZATION, token);
httpGet.setHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);