title: How to set onStatus in Spring WebClient builder instance
body: <p>I've got a lot of methods that use the onStatus API from Spring's WebClient:</p>
  <pre><code>@Override
  public Mono&lt;Accommodation&gt; createAccommodation(CreateAccommodation create) {
      return webClient
              .post()
              .contentType(APPLICATION_JSON)
              .bodyValue(create)
              .retrieve()
              .onStatus(HttpStatus::isError,
                      clientResponse -&gt; clientResponse
                              .bodyToMono(ApiErrorResponse.class)
                              .flatMap(errorResponse -&gt; Mono.error(new ResponseStatusException(
                                      HttpStatus.valueOf(errorResponse.getStatus()),
                                      errorResponse.getMessage()
                              ))))
              .bodyToMono(Accommodation.class);
  }
  </code></pre>
  <p>What I would like to do is to avoid having to use the &quot;onStatus&quot; in every single WebClient call.</p>
  <p>Is there a way to set this when building the WebClient instance? Can you show some examples?</p>
  <p>This is my WebClient instance:</p>
  <pre><code>    public AccommodationServiceClientImpl(WebClient.Builder builder) {
           this.webClient = builder
              .baseUrl(&quot;lb://accommodation-service/api/v1/accommodations&quot;)
              .build();
      }
  </code></pre>