title: Serving static web resources in Spring Boot & Spring Security application
body: <p>I am trying to develop Spring Boot web application and securing it using Spring security java configuration.</p>
  
  <p>After placing my static web resources in '<strong>src/main/resources/public</strong>' as advised <a href="http://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot">here in Spring blog</a>, I am able to get the static resources. i.e hitting <strong><code>https://localhost/test.html</code></strong> in browser do serves the html content.</p>
  
  <h2>Problem</h2>
  
  <p>After I enabled Spring Security, hitting the static resource URL requires authentication.</p>
  
  <p>My relevent  Spring Security Java config looks like this:-</p>
  
  <pre><code>@Override
      protected void configure(HttpSecurity http) throws Exception {
          // @formatter:off
          http.
              authorizeRequests()
                  .antMatchers("/","/public/**", "/resources/**","/resources/public/**")
                      .permitAll()
                  .antMatchers("/google_oauth2_login").anonymous()
                      .anyRequest().authenticated()
                  .and()
                  .formLogin()
                      .loginPage("/")
                      .loginProcessingUrl("/login")
                      .defaultSuccessUrl("/home")
                      .and()
                      .csrf().disable()
                      .logout()
                          .logoutSuccessUrl("/")
                          .logoutUrl("/logout") // POST only
                  .and()
                      .requiresChannel()
                      .anyRequest().requiresSecure()
                  .and()
                      .addFilterAfter(oAuth2ClientContextFilter(),ExceptionTranslationFilter.class)
                      .addFilterAfter(googleOAuth2Filter(),OAuth2ClientContextFilter.class)
                  .userDetailsService(userService);
          // @formatter:on
      }
  </code></pre>
  
  <p>How should I configure <strong>antMatchers</strong> to permit static resources placed inside src/main/resources/public ?</p>