How to set proxy on spring oauth2 OAuth2AccessToken request or How to override OAuth2AccessTokenSupport restTemplate variable?
I have tried to set network proxy in the following ways, but none of the method is working 1: set jvm variables like -Dhttp.proxyHost= -Dhttp.proxyPort= ....... 2: Created the Bean. @Bean public RestTemplate restTemplate() { final String proxyHost = "######"; // host final int proxyPort = ####; // port SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); factory.setProxy(new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort))); return new RestTemplate(factory); } But this configuration is overridden by OAuth2AccessTokenSupport.restTemplate. So the below