title: Filter order in spring-boot
body: <p>How can I specify order of my Filter in spring-boot? I need to insert my MDC filter after Spring Security filter. I tried almost everything but my filter was always first. This didn't work:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Bean
  @Order(Ordered.LOWEST_PRECEDENCE)
  public UserInsertingMdcFilter userInsertingMdcFilter() {
      return new UserInsertingMdcFilter();
  }
  </code></pre>
  
  <p>This didn't work too:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Bean
  public FilterRegistrationBean userInsertingMdcFilterRegistrationBean() {
      FilterRegistrationBean registrationBean = new FilterRegistrationBean();
      UserInsertingMdcFilter userFilter = new UserInsertingMdcFilter();
      registrationBean.setFilter(userFilter);
      registrationBean.setOrder(Integer.MAX_VALUE);
      return registrationBean;
  }
  </code></pre>