title: spring 2.5.6 @Controller does not work on JBOSS 7
body: <p>I recently migrated my codes from jboss 4.2.3 to jboss 7. There's something kind of weird and I can't figure out the reason. I used annotation @Controller at the top of my handler class, but it does not work any more. When I changed to use xml instead, it works fine. Any anybody give some hints?</p>
  
  <p>web.xml</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5"&gt;
  
      &lt;display-name&gt;asweb&lt;/display-name&gt;
  
      &lt;filter&gt;
        &lt;filter-name&gt;springCharacterEncodingFilter&lt;/filter-name&gt;
        &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
        &lt;init-param&gt;
          &lt;param-name&gt;encoding&lt;/param-name&gt;
          &lt;param-value&gt;UTF-8&lt;/param-value&gt;
        &lt;/init-param&gt;
      &lt;/filter&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;openEntityManagerInViewFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
        &lt;filter-name&gt;springCharacterEncodingFilter&lt;/filter-name&gt;
        &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;openEntityManagerInViewFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;openEntityManagerInViewFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/ws/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;sitemesh&lt;/filter-name&gt;
          &lt;filter-class&gt;
              com.opensymphony.module.sitemesh.filter.PageFilter
          &lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;sitemesh&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
  &lt;servlet&gt;
          &lt;servlet-name&gt;simple&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.sonatype.mavenbook.web.SimpleServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;simple&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/simple.do&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet&gt;
           &lt;servlet-name&gt;aswebmvc&lt;/servlet-name&gt;
           &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet
           &lt;/servlet-class&gt;
           &lt;load-on-startup&gt;3&lt;/load-on-startup&gt;
       &lt;/servlet&gt;
  
       &lt;servlet-mapping&gt;
           &lt;servlet-name&gt;aswebmvc&lt;/servlet-name&gt;
           &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
       &lt;/servlet-mapping&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/applicationContext.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/classes/log4j.properties&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;jsp-config&gt;
          &lt;taglib&gt;
              &lt;taglib-uri&gt;http://java.sun.com/jsp/jstl/core&lt;/taglib-uri&gt;
              &lt;taglib-location&gt;/WEB-INF/tld/c.tld&lt;/taglib-location&gt;
          &lt;/taglib&gt;
          &lt;taglib&gt;
              &lt;taglib-uri&gt;http://java.sun.com/jsp/jstl/fmt&lt;/taglib-uri&gt;
              &lt;taglib-location&gt;/WEB-INF/tld/fmt.tld&lt;/taglib-location&gt;
          &lt;/taglib&gt;
      &lt;/jsp-config&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>aswebmvc-servlet.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:context="http://www.springframework.org/schema/context" 
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
         http://www.springframework.org/schema/context  
         http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;
  
      &lt;context:component-scan base-package="com.xxx.appstore.web.controller" /&gt;
      &lt;context:component-scan base-package="com.xxx.appstore.web.controller.admin" /&gt;
  
      &lt;bean id="webController" class="com.xxx.appstore.web.controller.WebController"/&gt;
  
      &lt;bean id="localeChangeInterceptor"
          class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
          &lt;property name="paramName" value="local" /&gt;
      &lt;/bean&gt;
      &lt;bean id="handlerMapping"
          class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt;
          &lt;property name="interceptors"&gt;
              &lt;ref bean="localeChangeInterceptor" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
          &lt;property name="synchronizeOnSession" value="true"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="order" value="1" /&gt;
          &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>My Controller Class</p>
  
  <pre><code>package com.xxx.appstore.web.controller;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.ModelMap;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  
  @Controller
  public class WebController 
  {
  
      private static Log logger = LogFactory.getLog(WebController.class);
  
      @RequestMapping("home.do")
      public String home2(HttpServletRequest request, ModelMap model) {
           return "";
       }
     @RequestMapping("/home.do")
      public String home(HttpServletRequest request, ModelMap model) {
  
          return "web/home";
      }
  
  }
  </code></pre>
  
  <p>I have updated the configuration files, which work for me for most annotations.</p>