0

we are trying to upgrade spring from 4.x to 5.3.x

this is the dispatcher-servlet.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- The facade for the ConfigOps EJB -->
    <bean id="configOps" class="com.sample.Config" scope="prototype" />

    <!-- Main controller beans-->
    <bean id="actionController" class="com.ui.controllers.ActionController" >
        <property name="configOps" ref="configOps" />
    </bean>
    <bean id="nodeController" class="com.ui.controllers.NodeController" >
        <property name="configOps" ref="configOps" />
    </bean>
    <bean id="wizardController" class="com.ui.controllers.WizardController" >
    <property name="configOps" ref="configOps" />
    <property name="nodeController" ref="nodeController" />
   </bean>
    <bean id="exceptionResolver"  class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="exceptionMappings">
            <props>
                <prop key="java.lang.Exception">errorView</prop>
            </props>
        </property>
    </bean>
    
      
    <!-- Simple URL based handler mapping -->
      <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>
                /**/actions.do=actionController
                /**/nodes.do=nodeController
                /**/wizard.do=wizardController
            </value>
        </property>
    </bean>

    <!-- View resolver for action controllers -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.XmlViewResolver">
    </bean>
</beans>

Note: here wizardcontroller is annotated with @controller which has annotation like @Requestmapping and nodecontroller,actioncontroller extends abstractcontroller which has some methods.

i tried by adding mvc:annotation-driven in dispatcher xml file as per some of answers, but still same issue..

how we can the change the code to work with spring 5.3.x?

3
  • As mentioned in the other thread you commented on this isn't supported any more. Add the mapping to the @RequestMapping on the controller and remove it from the urlMapping. This applies to all your controllers that are annotated. And add <mvc:annotation-driven /> Commented Mar 8, 2022 at 18:02
  • @M.Deinum ,yes i tried it worked, but why we need to do that. Commented Mar 9, 2022 at 7:51
  • Read the release notes of SPring 5.0 and 4.3 which explains that. Commented Mar 9, 2022 at 8:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.