title: Spring WebClient get request return "Connection refused: localhost/"
body: <p>When I'm trying to send GET request with WebClient, I have responce with error io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/</p>
  
  <p><strong>* WebClient initialization *</strong></p>
  
  <pre><code>//hostname = "localhost/127.0.0.1:8081"
  //contextPath = "user-service"
  
      @Bean
      public WebClient userWebclient(@Value("${service.user.hostname}") final String hostname,
                                    @Value("${service.user.contextPath}") final String contextPath) {
          return WebClient
                  .builder()
                  .baseUrl(hostname + contextPath)
                  .build();
      }
  </code></pre>
  
  <p><strong>* Controller *</strong></p>
  
  <pre><code>    private final WebClient userWebclient;
  
      @GetMapping(value = "/user/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
      public Mono&lt;String&gt; getUserById(@NotNull @PathVariable String userId) {
          userWebclient.
  
          return userWebclient.get()
                 .uri("/UserMock/user/" + userId)
                 .header("Accept", "application/json")
                 .header("Authorization", "Bearer =........")
                 .exchange()
                 .flatMap(response -&gt; response.bodyToMono(String.class));
      }
  </code></pre>
  
  <p><strong><em>Error message</em></strong></p>
  
  <pre><code>io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:8081
      at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
      at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
      at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327)
      at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
      at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:665)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
      at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491)
      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
      at java.lang.Thread.run(Thread.java:748)
  Caused by: java.net.ConnectException: Connection refused
      ... 10 common frames omitted
  </code></pre>