Problem with metadata for MVC
I'm having a problem which I can't seem to solve.
I read through chapter 8 of the Spring reference guide and tried to implement - for starters - the handler mapping for one of my controllers as described in section 8.5. I added the following line to my controller:
Code:
@@org.springframework.web.servlet.handler.metadata.PathMap("/ca.ctrl")
I then added the proper CommonsPathMapHandlerMapping entry to my xml config file. Did the ant task and everything compiled fine. Then jar'd and indexed and deployed. When the app starts up I get this error:
Code:
[05/08/05-14:18 ERROR FrameworkServlet.initServletBean] Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.test.web.section.content.admin.controller.ContentAdminController' defined in null: Unsatisfied dependency expressed through bean property 'delegate': There are 118 beans of type [class java.lang.Object] for autowire by type. There should have been 1 to be able to autowire property 'delegate' of bean 'com.test.web.section.content.admin.controller.ContentAdminController'.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:754)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:673)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire(AbstractAutowireCapableBeanFactory.java:160)
at org.springframework.web.servlet.handler.metadata.AbstractPathMapHandlerMapping.initApplicationContext(AbstractPathMapHandlerMapping.java:128)
at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:89)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:80)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:204)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:260)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:282)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:303)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:250)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:219)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:111)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3043)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:4658)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1619)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1628)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1628)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
at java.lang.Thread.run(Thread.java:613)
I dug through all the Spring source including the exceptions to see if I could get some clue as to what it's actually saying. But I couldn't figure anything out. If I could get this to work, I'd love to do all my controller and service defs thru metadata as I feel it's much easier to deal with than a ton of xml entries. However, even on the most basic example, I can't seem to figure it out.
I still have my xxx-servlet.xml entries which work fine when I disable the metdata stuff.
Any help would be appreciated. Thx.