I work on an application that was developed under Spring 2.5 using XML mappings. Recently, we upgraded our JARS to Spring 3.0 and also added in some component scanning in an attempt to use Spring 3.0's new MVC features, while still maintaining our existing XML mappings.
However, if we were to add the following to enable sping mvc annotations
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- The following is the new XML configuration that we have tried to add -->
<mvc:annotation-driven/>
<!-- ... old XML mappings -->
</beans>
Then, Spring only looks for Controllers annotated with @Controller and our old XML mappings seem to get ignored. Is the only solution to this problem, that we need to update all our old XML mappings to be annotations based (a daunting task) or is there some other solution?
One example of our old XML mappings is as follows:
<bean id="loginController" class="com.app.controller.login.LoginController">
<property name="loginService" ref="loginService"/>
</bean>
The LoginController extends SimpleFormController. Many other of our old controllers either extend SimpleFormController or MultiActionController.
And this is how our Controllers are mapped.
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/login">loginController</prop>
...
LoginController? Does it implement theControllerinterface? How were you mapping the URL to that controller? - skaffman