title: Add ShallowEtagHeaderFilter in Spring Boot MVC
body: <p>I'm trying to adjust my application configuration in order to setup ETag support.</p>
  
  <p>I have just checked <a href="https://stackoverflow.com/questions/26151057/add-a-servlet-filter-in-a-spring-boot-application/26157610">this</a> SO question, so let me say where my code is different from it:</p>
  
  <ol>
  <li>I don't use any xml configuration file whatsoever.</li>
  <li>I'm using different configuration classes for each aspect of the system. My <code>WebConfig</code> looks like this:</li>
  </ol>
  
  <pre>
  <code>
  @Configuration
  @EnableAutoConfiguration
  @ComponentScan(basePackages = { "xxx", "yyy" })
  public class WebConfig extends WebMvcConfigurerAdapter {
  
     @Bean
     public Filter shallowETagHeaderFilter() {
          return new ShallowEtagHeaderFilter();
     }
        ...
  }
  </code>
  </pre>
  
  <ol start="3">
  <li>And my SecurityConfig looks like this:</li>
  </ol>
  
  <pre>
  <code>
      @Configuration
      @EnableWebSecurity
      public class SecurityConfig extends WebSecurityConfigurerAdapter {
          ...
  
          @Override
          protected void configure(final HttpSecurity http) throws Exception {
              http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                  .and().exceptionHandling()
                          .authenticationEntryPoint(authenticationEntryPoint())
                  .and().authorizeRequests()
                          .antMatchers(HttpMethod.GET, "/**").authenticated()
                          .antMatchers(HttpMethod.POST, "/**").authenticated()
                          .antMatchers(HttpMethod.HEAD, "/**").authenticated()
              .and().csrf().disable()    
              .addFilterBefore(authenticationTokenProcessingFilter(), UsernamePasswordAuthenticationFilter.class);
          }
  
      }
  </code>
  </pre>
  
  <ol start="4">
  <li>I also have an initializer class, which is empty:</li>
  </ol>
  
  <pre>
  <code>
      @Order(value=1)
      public class SecurityWebAppInitializer extends AbstractSecurityWebApplicationInitializer {
  
      }
  </code>
  </pre>
  
  <p>I don't see anywhere the <code>ShallowEtagHeaderFilter</code> been added to the default chain or anything, how can I use it in this setup?</p>