title: spring gwt - cannot add restful webservice - RequestMapping exception
body: <p>I started a gwt spring 3 project thought spring roo. Then I took roo off the project and implemented spring security, everything working as expected.</p>
  
  <p>But I am having a problem to add restful controllers to my project. Basically it should have been easy, but, since I am using GWT, maybe it has to do with some of the configurations.</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.bind.annotation.RequestMapping.consumes()[Ljava/lang/String;</p>
  </blockquote>
  
  <p>I thought this would mean I am missing some kind of dependency, but I checked, I am using all spring dependencies possible and required in all example projects that I researched, so I am assuming its another thing.</p>
  
  <p>My restful controller below</p>
  
  <pre><code>@RequestMapping("/api")
  @Controller
  public class TestControler {
  
     @RequestMapping("/test")
     @ResponseBody
     public String getAll() {
        return "aba";
     }
  </code></pre>
  
  <p>My <code>web.xml</code></p>
  
  <pre><code>    &lt;context-param&gt;
          &lt;param-name&gt;defaultHtmlEscape&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath*:META-INF/spring/applicationContext*.xml 
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;CharacterEncodingFilter&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;init-param&gt;
              &lt;param-name&gt;forceEncoding&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;HttpMethodFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.HiddenHttpMethodFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;Spring OpenEntityManagerInViewFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter&lt;/filter-class&gt;
      &lt;/filter&gt;    
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;    
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;HttpMethodFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;Spring OpenEntityManagerInViewFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;    
  
      &lt;!-- Handles Spring requests --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;myapp&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;WEB-INF/spring/webmvc-config.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;requestFactory&lt;/servlet-name&gt;
          &lt;servlet-class&gt;com.myapp.CustomRequestFactoryServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;       
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;myapp&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;    
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;requestFactory&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/gwtRequest&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;10&lt;/session-timeout&gt;
      &lt;/session-config&gt;
  </code></pre>
  
  <p>My servlet spring mvc config</p>
  
  <pre><code>&lt;context:component-scan base-package="br.ufsc.inf.citymobile"
      use-default-filters="false"&gt;
      &lt;context:include-filter expression="org.springframework.stereotype.Controller"
          type="annotation" /&gt;
  &lt;/context:component-scan&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;mvc:resources location="/, classpath:/META-INF/web-resources/"
      mapping="/resources/**" /&gt;
  
  &lt;mvc:default-servlet-handler /&gt;
  
  &lt;mvc:interceptors&gt;
      &lt;bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" /&gt;
      &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"
          p:paramName="lang" /&gt;
  &lt;/mvc:interceptors&gt;
  
  &lt;mvc:view-controller path="/" view-name="index" /&gt;
  &lt;mvc:view-controller path="/uncaughtException" /&gt;
  &lt;mvc:view-controller path="/resourceNotFound" /&gt;
  &lt;mvc:view-controller path="/dataAccessFailure" /&gt;
  
  &lt;bean       class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
      id="messageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application"
      p:fallbackToSystemLocale="false" /&gt;
  
  &lt;bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver"
      id="localeResolver" p:cookieName="locale" /&gt;
  
  &lt;bean
      class="org.springframework.ui.context.support.ResourceBundleThemeSource"
      id="themeSource" /&gt;
  
  &lt;bean class="org.springframework.web.servlet.theme.CookieThemeResolver"
      id="themeResolver" p:cookieName="theme" p:defaultThemeName="standard" /&gt;
  
  &lt;bean       class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"
      p:defaultErrorView="uncaughtException"&gt;
      &lt;property name="exceptionMappings"&gt;
          &lt;props&gt;
              &lt;prop key=".DataAccessException"&gt;dataAccessFailure&lt;/prop&gt;
              &lt;prop key=".NoSuchRequestHandlingMethodException"&gt;resourceNotFound&lt;/prop&gt;
              &lt;prop key=".TypeMismatchException"&gt;resourceNotFound&lt;/prop&gt;
              &lt;prop key=".MissingServletRequestParameterException"&gt;resourceNotFound&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean
      class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
      id="multipartResolver" /&gt;
  </code></pre>
  
  <p>My application context</p>
  
  <pre><code>&lt;context:annotation-config /&gt;
  
  &lt;context:property-placeholder location="classpath*:META-INF/spring/*.properties" /&gt;
  
  &lt;context:spring-configured /&gt;
  
  &lt;context:component-scan base-package="br.ufsc.inf.citymobile"&gt;
      &lt;context:exclude-filter expression=".*_Roo_.*"
          type="regex" /&gt;
      &lt;context:exclude-filter expression="org.springframework.stereotype.Controller"
          type="annotation" /&gt;
  &lt;/context:component-scan&gt;
  
  &lt;bean class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close" id="dataSource"&gt;
      &lt;property name="driverClassName" value="${database.driverClassName}" /&gt;
      &lt;property name="url" value="${database.url}" /&gt;
      &lt;property name="username" value="${database.username}" /&gt;
      &lt;property name="password" value="${database.password}" /&gt;
      &lt;property name="testOnBorrow" value="true" /&gt;
      &lt;property name="testOnReturn" value="true" /&gt;
      &lt;property name="testWhileIdle" value="true" /&gt;
      &lt;property name="timeBetweenEvictionRunsMillis" value="1800000" /&gt;
      &lt;property name="numTestsPerEvictionRun" value="3" /&gt;
      &lt;property name="minEvictableIdleTimeMillis" value="1800000" /&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.orm.jpa.JpaTransactionManager"
      id="transactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven mode="aspectj"
      transaction-manager="transactionManager" /&gt;
  
  &lt;bean
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
      id="entityManagerFactory"&gt;
      &lt;property name="persistenceUnitName" value="persistenceUnit" /&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
  &lt;/bean&gt;
  </code></pre>