score:0

Here our controller class should extends

import org.springframework.web.servlet.mvc.AbstractController;

public class AppController extends AbstractController{ }

Here we need to implement the abstract method as :

protected modelandview handleRequestInternal(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception { return null; }

score:1

Make sure you have implemented Controller in your controller classes and overrided handleRequest method.

score:2

Try adding the following as a handler mapper(Worked for me):

<bean id="HandlerMapping" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>

score:2

This problem occurred for me when I tried to define RestController path by using in this way:

@RestController("/test")
public class TestController {}

In the above section, the meaning of this declaration is different. Here actually "/test" is defined as bean name rather than path for the controller.

After defining the path in this way it worked for me:

@RestController
@RequestMapping("/test")
public class TestController {}

score:12

I resolved the issue. I forgot to add the @Controller annotation in controller class. There are fore we can use the both methods(annotation mapping & XML mapping) together in an application.

score:26

This error also occurs when you define a restController but forget to define the requestMapping.

@RestController
@RequestMapping("/api/orders") // <---- dont't forget the requestMapping

Related Query

More Query from same tag