title: Spring MVC Controller using Groovy
body: <p>I'm setting up a webapp and I'm trying to use Groovy instead of Java. I have the basic setup, the webapp starts. So far I have one Controller with the appropriate annotations. During startup the RequestMappings are mapped, but when I try to access the mapping, the webapp answers with a 404.</p>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/7534529/spring-mvc-annotated-controller-in-groovy">this post</a>, but it didn't solve my problem (neither using interfaces nor the PostProcessor).</p>
  
  <p>Here's the log from the application startup, I can't see anything that looks strange:</p>
  
  <pre><code>17:16:10.231 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.web.context.ContextLoader - Root WebApplicationContext: initialization started
  17:16:10.235 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.c.s.AnnotationConfigWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Tue Jan 22 17:16:10 CET 2013]; root of context hierarchy
  17:16:10.296 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.c.s.AnnotationConfigWebApplicationContext - Registering annotated classes: [class de.rpr.query.config.AppConfig]
  17:16:10.902 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7d21c8c4: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,appConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,queryController,delegatingWebMvcConfiguration,requestMappingHandlerMapping,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,defaultServletHandlerMapping,requestMappingHandlerAdapter,mvcConversionService,mvcValidator,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,webConfig,jacksonObjectMapper,jacksonMessageConverter,viewResolver,groovyObjectPostProcessor]; root of factory hierarchy
  17:16:11.060 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/query/show],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object de.rpr.query.controller.QueryController.showQueryForm()
  17:16:11.124 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
  17:16:11.638 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1403 ms
  17:16:11.649 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization started
  17:16:11.656 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.c.s.AnnotationConfigWebApplicationContext - Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue Jan 22 17:16:11 CET 2013]; parent: Root WebApplicationContext
  17:16:11.660 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.c.s.AnnotationConfigWebApplicationContext - Registering annotated classes: [class de.rpr.query.config.WebConfig]
  17:16:11.701 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@35d0be7c: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,webConfig,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,delegatingWebMvcConfiguration,requestMappingHandlerMapping,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,defaultServletHandlerMapping,requestMappingHandlerAdapter,mvcConversionService,mvcValidator,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,jacksonObjectMapper,jacksonMessageConverter,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@7d21c8c4
  17:16:11.829 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
  17:16:11.971 [RMI TCP Connection(3)-127.0.0.1] INFO  o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 322 ms
  </code></pre>
  
  <p>This is the controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/mapping")
  class QueryController {
  
      @RequestMapping("/show")
      def show() {
          return "show";
      }
  }
  </code></pre>
  
  <p>Am I missing something or doing something wrong? Help is greatly appriciated!</p>