2013-02-06 73 views
2

我试图用RequestMappingHandlerAdapter初始化调试一个问题,并且我通过搜索Web从mvc:annotation-driven xml条目得出初始化结论。任何人都可以简单地解释我,这个初始化是如何工作的,例如当解析器解析mvc:annotation-driven时会发生什么?或者将我的代码指向它,我会追踪它。了解mvc的初始化时间行为:注释驱动

这方面的一些更多的上下文:

,我试图通过自动装配从上下文获得RequestMappingHandlerAdapter但不能。它给了我:

No matching bean of type [org.springframework.web.servlet.mvc.method.annotation.RequestMappingH 
andlerAdapter] 
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} 

发现这个线程,但该解决方案并不不起作用:Spring, Jackson and Customization (e.g. CustomDeserializer)

我使用:春天3.1.3

这是我的servlet的XML文件的样子...

<context:annotation-config /> 
<context:component-scan base-package="com.xyz" /> 
<mvc:annotation-driven /> 

感谢, PARTH

+0

它只是打我,mvc:注解驱动的配置顺序是错误的。我扭转了它,它的工作! – Parth

回答