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.
I’ve seen this post, but it didn’t solve my problem (neither using interfaces nor the PostProcessor).
Here’s the log from the application startup, I can’t see anything that looks strange:
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
This is the controller:
@Controller
@RequestMapping("/mapping")
class QueryController {
@RequestMapping("/show")
def show() {
return "show";
}
}
Am I missing something or doing something wrong? Help is greatly appriciated!
What the heck, check this out, 2nd bullet down:
Configuring and implementing Spring-style applications using Groovy 2:
Groovy-based bean definitions; Groovy as the language of choice for an entire app
from NEXT STOP: SPRING FRAMEWORK 4.0
So you might be just tiny bit ahead of the time here :-). But you probably already knew that.