What is the difference between controller and handler in Java – spring MVC?
Spring MVC documentation sometimes says "handler" or "request handler" For example, http://docs.spring.io/autorepo/docs/spring/4.0.4.RELEASE/javadoc-api/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.html Say:
Sometimes it says controller For example, there is one called org springframework. web. servlet. mvc. Interface of controller( http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/web/servlet/mvc/Controller.html ).
My question is: are the controllers and handlers the same?
Solution
Generally speaking, the controller is the handler, but the handler is not necessarily the controller
For example, httprequesthandler, webrequesthandler and messagehandler are all handlers that can use dispatcher servlet (@) controller is the handler that executes the web request and returns the view.)
In short, handler is just a term. It is neither a class nor an interface It is responsible for performing the mapping