title: Spring MVC Java WebMvcConfigurerAdapter.addResourceHandlers
body: <p>I'm looking at a project with the following Java Configuration file:</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan("spittr.web")
  public class WebConfig extends WebMvcConfigurerAdapter {
  
    @Bean
    public ViewResolver viewResolver() {
      InternalResourceViewResolver resolver = new InternalResourceViewResolver();
      resolver.setPrefix("/WEB-INF/views/");
      resolver.setSuffix(".jsp");
      return resolver;
    }
  
    @Override
    public void   configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
      configurer.enable();
    }
  
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
      super.addResourceHandlers(registry);
    }
  
  }
  </code></pre>
  
  <p>The project has some static resources in the webapps/resources directory that are being served up. My question is I'm not sure why. It seems for this to work, the above call to addResourceHandlers(...) should be</p>
  
  <pre><code>@Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**").addResourceLocations("/resources");
  }
  </code></pre>
  
  <p>I tried to look for something in the Spring documentation possibly indicating default values but could not, so I'm not sure why the project works.</p>