title: BindingResult does not work, thymeleaf can't see it
body: <p>I have this method</p>
  <pre><code>    @PostMapping
  public String saveOrder(@Valid @ModelAttribute OrderCreationDto order,
                          BindingResult bindingResult,
                          @AuthenticationPrincipal AuthenticatedUser authenticatedUser,
                          Model model) {
      System.out.println(&quot;BINDING &quot; + bindingResult);
  
      if (bindingResult.hasErrors()) {
          fillMenuModelWithData(model);
          return &quot;menu&quot;;
      }
  
  
      try {
          orderService.saveOrder(order, authenticatedUser);
      } catch (InsufficientFundsException e) {
          log.debug(e.toString());
          fillMenuModelWithData(model);
          return &quot;menu&quot;;
      }
      return &quot;redirect:/orders/history&quot;;
  }
  </code></pre>
  <p>And this helper method just to fill models with needed attributes</p>
  <pre><code>    private void fillMenuModelWithData(Model model) {
      model.addAttribute(&quot;sortField&quot;, DEFAULT_SORT_FIELD);
      model.addAttribute(&quot;sortDir&quot;, DEFAULT_SORT_DIR);
      model.addAttribute(&quot;filterCategory&quot;, DEFAULT_CATEGRY);
      model.addAttribute(&quot;pageSize&quot;, DEFAULT_PAGE_SIZE);
      model.addAttribute(&quot;filterCategory&quot;, DEFAULT_CATEGRY);
      model.addAttribute(&quot;order&quot;, new OrderCreationDto());
      model.addAttribute(&quot;dishList&quot;, dishService.findAllDishesSorted(
              DEFAULT_SORT_FIELD, DEFAULT_SORT_DIR));
  }
  </code></pre>
  <p>As you can see, I print to console with <code>System.out.println</code> my BindingResult and it looks like this.</p>
  <blockquote>
  <p>BINDING org.springframework.validation.BeanPropertyBindingResult: 2
  errors</p>
  </blockquote>
  <blockquote>
  <p>Field error in object 'orderCreationDto' on field 'address':
  rejected value [ ]; codes
  [NotBlank.orderCreationDto.address,NotBlank.address,NotBlank.java.lang.String,NotBlank];
  arguments
  [org.springframework.context.support.DefaultMessageSourceResolvable:
  codes [orderCreationDto.address,address]; arguments []; default
  message [address]]; default message [Address cannot be empty]</p>
  <p>Field error in object 'orderCreationDto' on field 'dishIdQuantityMap':
  rejected value [{752=0, 952=0}]; codes
  [HasOrder.orderCreationDto.dishIdQuantityMap,HasOrder.dishIdQuantityMap,HasOrder.java.util.Map,HasOrder];
  arguments
  [org.springframework.context.support.DefaultMessageSourceResolvable:
  codes [orderCreationDto.dishIdQuantityMap,dishIdQuantityMap];
  arguments []; default message [dishIdQuantityMap]]; default message
  [Order does not contain any Dishes]</p>
  </blockquote>
  <p>Seems like everything ok, let's see if we have any erros on <code>menu</code> page.</p>
  <pre><code>               &lt;p th:text=&quot;${#fields.errors()}&quot;&gt;&lt;/p&gt;
              &lt;p th:text=&quot;${#fields.hasAnyErrors()}&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>And we see nothing</p>
  <p><a href="https://i.stack.imgur.com/ytk2M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ytk2M.png" alt="enter image description here" /></a></p>
  <p>I've tried to debug this on my own for the whole night, need your help a lot!</p>
  <p>UPD:</p>
  <p>Here is the error I get skip adding new Order in Post method</p>
  <pre><code> Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'order' available as request attribute
  </code></pre>