我一直在从事一个项目,其中控制器是为了扩展控制器类而编写的。我可以在同一应用程序中配置和使用基于 POJO 的控制器(使用 @Controller)吗?
非常感谢
感谢 jamestastic 和 skaffman,现在一切正常:)
以下是需要添加到 Web 配置文件中以使它们协同工作的行:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" ...line1
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context ...line2
http://www.springframework.org/schema/context/spring-context-2.5.xsd"> ...line3
<context:annotation-config/> ...line4
<context:component-scan base-package="myPackage"/> ...line5
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/> ...line6
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/> ...line7
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/> ...line8
</beans>
我太懒了,没有在我的主应用程序中添加第 8 行。
非常感谢
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)