One of the most exiting feature of the Spring Framework is allowing to integrate a third party framework with Spring MVC. Though most of the developer working with spring do not use because most of the application consists of only Controllers which is configured by default and no explicit configuration is required. To integrate with a system developed by other framework, this an exciting tool. HandlerAdapter (org.springframework.web.servlet.HandlerAdapter) is a system level interface that enables low coupling between different request handlers and the DispatcherServlet. The interface is like the following:
package org.springframework.web.servlet;
public interface HandlerAdapter {
boolean supports(Object handler);
ModelAndView handle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception;
long getLastModified(HttpServletRequest request, Object handler);
}
Here is a sample of implementation of HandlerAdapter Interface named SampleFrameworkHandlerAdapter. DispatcherServlet first call support() to check the HandleAdapter support a Handler, if yes then go to handle method for model and view
public class SampleFrameworkHandlerAdapter implements HandlerAdapter {
public boolean supports(Object handler) {
return (handler != null) && (handler instanceof ExoticFramework);
}
public ModelAndView handle(HttpServletRequest req, HttpServletResponse res,
Object handler) throws Exception {
ExoticResult result = ((ExoticFramework)handler).executeRequest(req, res);
return adaptResult(result);
}
private ModelAndView adaptResult(ExoticResult result) {
ModelAndView mav = new ModelAndView();
mav.getModel().putAll(result.getObjectsToRender());
return mav;
}
public long getLastModified(HttpServletRequest req, Object handler) {
return -1;
}
}
You have to make the configuration in the ApplicationContext by a bean with showing full class path. DispatcherServlet looks at the ApplicationContext by default for all HandlerAdapter and find all by their type. But you must notice that when you specify a HandlerAdapter, the SimpleControllerHandlerAdapter (the default one) will not be used, you have to specify all the HandlerAdapter explicitly.
By, Md. Shahjalal
Source: Expert Spring MVC and Web Flow
Posted by Md. Shahjalal 
