Is there any way to set the network proxy and credentials in spring boot configuration?
Please help me out.
I'm using RestTemplate to call the rest api.
Is there any way to set the network proxy and credentials in spring boot configuration?
Please help me out.
I'm using RestTemplate to call the rest api.
You should enable proxy using below code snippets
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
InetSocketAddress address = new InetSocketAddress(host,portNr);
Proxy proxy = new Proxy(Proxy.Type.HTTP,address);
factory.setProxy(proxy);
restTemplate.setRequestFactory(factory);