title: I get WebClientResponseException$ServiceUnavailable error when I use @LoadBalanced annotated WebClient.Builder
body: <p>When I use @LoadBalanced annotation for WebClient.Builder I get following stack trace from external API.
  The demo I wrote before this was returning hardcoded data and I use EurekaServer. That application also giving error because I didn't annotated my WebClient.Builder with @LoadBalanced so how can I use this for both usage I believe its happening because server has one or multiple instances.</p>
  
  <p>MainApp</p>
  
  <pre><code>@SpringBootApplication
  @EnableEurekaClient
  public class MovieInfoServiceApplication {
  
      @Bean
      @LoadBalanced
      public WebClient.Builder getWebClientBuilder() {
          return WebClient.builder();
  
      }
          public static void main(String[] args) {
          SpringApplication.run(MovieInfoServiceApplication.class, args);
      }
  
  }
  </code></pre>
  
  <p>RestController</p>
  
  <pre><code>@RestController
  @RequestMapping("/movies")
  public class MovieRestController {
  
  api key field
  
      @Autowired
      private WebClient.Builder webClientBuilder;
  
  @RequestMapping("/{movieId}")
      public Movie getMovieById(@PathVariable("movieId") int movieId) {
  Movie movieDetails = webClientBuilder
                  .build()
                  .get()
                  .uri("https://api.themoviedb.org/3/movie/" + movieId + "?api_key=" + apiKey)
                  .retrieve()
                  .bodyToMono(Movie.class).block();
  
          return new Movie(movieId, movieDetails.getTitle(), movieDetails.getOverview());
  }
  }
  </code></pre>
  
  <p>Stack trace</p>
  
  <pre><code>500 Internal Server Error from GET http://localhost:8082/movies/550
  org.springframework.web.reactive.function.client.WebClientResponseException$InternalServerError: 500 Internal Server Error from GET http://localhost:8082/movies/550
      at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:201)
      Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
  Error has been observed at the following site(s):
      |_ checkpoint ⇢ 500 from GET http://movie-info-service/movies/550 [DefaultWebClient]
  Stack trace:
          at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:201)
          at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:209)
          at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)
  </code></pre>
  
  <p>After <a href="https://github.com/spring-cloud/spring-cloud-commons/issues/295#issuecomment-414206032" rel="nofollow noreferrer">https://github.com/spring-cloud/spring-cloud-commons/issues/295#issuecomment-414206032</a> this implementation</p>
  
  <p>MainApp</p>
  
  <pre><code>
  @SpringBootApplication
  
  @EnableEurekaClient
  
  public class MovieInfoServiceApplication {
  
  
  
      @Bean
  
      WebClient webClient(LoadBalancerClient loadBalancerClient) {
  
          return WebClient.builder()
  
                  .filter(new LoadBalancerExchangeFilterFunction(loadBalancerClient))
  
                  .build();
  
      }
  
  
  
      public static void main(String[] args) {
  
          SpringApplication.run(MovieInfoServiceApplication.class, args);
  
      }
  
  
  
  }
  
  </code></pre>
  
  <p>RestController</p>
  
  <pre><code>
  @RestController
  
  @RequestMapping("/movies")
  
  public class MovieRestController {
  
  
  
      @Value("${api.key}")
  
      private String apiKey;
  
  
  
      @Autowired
  
      private WebClient webClient;
  
  
  
  
  
      @RequestMapping("/{movieId}")
  
      public Movie getMovieById(@PathVariable("movieId") int movieId) {
  
  
  
          Movie movieDetails = webClient
  
                  .get()
  
                  .uri("https://api.themoviedb.org/3/movie/" + movieId + "?api_key=" + apiKey)
  
                  .retrieve()
  
                  .bodyToMono(Movie.class)
  
                  .block();
  
  
  
  
  
          return new Movie(movieId, movieDetails.getTitle(), movieDetails.getOverview());
  
  
  
      }
  
  }
  
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  
  Sun May 03 19:15:51 EET 2020
  
  There was an unexpected error (type=Internal Server Error, status=500).
  
  503 Service Unavailable from UNKNOWN 
  
  org.springframework.web.reactive.function.client.WebClientResponseException$ServiceUnavailable: 503 Service Unavailable from UNKNOWN 
  
      at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:207)
  
      Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
  
  Error has been observed at the following site(s):
  
      |_ checkpoint ⇢ 503 from GET https://api.themoviedb.org/3/movie/551?api_key=apikeyvalue [DefaultWebClient]
  
  Stack trace:
  
          at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:207)
  
          at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:209)
  
          at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)
  
          at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.java:92)
  
          at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
  
          at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onNext(FluxContextStart.java:103)
  
          at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:287)
  
  </code></pre>