title: Spring 3.1.1 java based configuration issue
body: <p>I have been using the new feature of Spring 3.1.1 the "java based configuration".
  I have faced an issue while creating a small demo to test that new concept.</p>
  
  <p>When I deploy my "springway.war" over tomcat ,when I request "http://localhost:8080/springway/" --> I gout "HTTP Status 404"</p>
  
  <p>I am sure that I missing something but I couldn't figure it out .
  I have been looking at the "GreenHouse" example that is over Spring site but I still get the same issue.</p>
  
  <p>Here is my WebConfig.java :</p>
  
  <pre><code>package config;
  
  import java.util.List;
  
  import javax.inject.Inject;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.support.ReloadableResourceBundleMessageSource;
  import org.springframework.core.env.Environment;
  import org.springframework.http.converter.HttpMessageConverter;
  import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
  
  import org.springframework.validation.Validator;
  import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
  
  import org.springframework.web.multipart.MultipartResolver;
  import org.springframework.web.multipart.commons.CommonsMultipartResolver;
  import org.springframework.web.servlet.ViewResolver;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  
  import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  import org.springframework.web.servlet.view.UrlBasedViewResolver;
  import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
  import org.springframework.web.servlet.view.freemarker.FreeMarkerView;
  import org.springframework.web.servlet.view.tiles2.TilesConfigurer;
  import org.springframework.web.servlet.view.tiles2.TilesView;
  
  @Configuration
  @EnableWebMvc
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Inject
      private Environment environment;
  
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
      }
  
      public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) {
          converters.add(new MappingJacksonHttpMessageConverter());
      }
  
  
      /**
       * ViewResolver configuration required to work with Tiles2-based views.
       */
      @Bean
      public ViewResolver viewResolver() {
          UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
          viewResolver.setViewClass(FreeMarkerView.class);
          return viewResolver;
      }
  
      /**
       * Configures Tiles at application startup.
       */
      @Bean
      public TilesConfigurer tilesConfigurer() {
          TilesConfigurer configurer = new TilesConfigurer();
          configurer.setDefinitions(new String[]{
                  "/WEB-INF/layouts/tiles.xml",
                  "/WEB-INF/views/**/tiles.xml"
          });
          configurer.setCheckRefresh(true);
          return configurer;
      }
  
  //    @Bean
  //    public FreeMarkerConfigurer freeMarkerConfigurer() {
  //        FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
  //        configurer.setTemplateLoaderPath(
  //
  //                "/WEB-INF/views/**/freemarker.xml");
  ////        configurer.set(true);
  //        return configurer;
  //    }
  
      @Bean
      public MultipartResolver multipartResolver() {
          CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
          multipartResolver.setMaxUploadSize(500000);
          return multipartResolver;
      }
  }
  </code></pre>
  
  <p>And the web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
      &lt;!-- Java-based annotation-driven Spring container definition --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextClass&lt;/param-name&gt;
          &lt;param-value&gt;org.springframework.web.context.support.AnnotationConfigWebApplicationContext&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Location of Java @Configuration classes that configure the components that makeup this application --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;config&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Specifies the default mode of this application, to be activated if no other profile (or mode) is specified --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;spring.profiles.default&lt;/param-name&gt;
          &lt;param-value&gt;embedded&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
  
           &lt;!-- Handles requests into the application --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;!-- No explicit configuration file reference here: everything is configured in the root container for simplicity --&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>