In my microservice I have to fetch data from places. Some of the URL's are fixed but some are not . So do I need to create Webclient again and again if my base URL changes. If not then is the below way correct to create Web Client. WebClient.create(); and later changing the URI again and again whenever I make a call. As per my understanding creating a WebClient must be some heavy operation.
ReactorClientHttpConnector connector = new ReactorClientHttpConnector(
options -> options.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, requestTimeout).compression(true)
.afterNettyContextInit(ctx -> ctx.addHandlerLast(new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS))));
return WebClient.builder()
.clientConnector(connector)
.baseUrl(hostURL)
.build();