This example will show the way to add a AbstractController in the Spring framework.

ExampleController.java

 package examples;

public class ExampleController extends AbstractController {
  
  public ModelAndView handleRequestInternal(HttpServletRequest request,
    HttpServletResponse response) throws Exception 
  {
    ModelAndView mav = new ModelAndView("foo");
    mav.addObject("message", "Hello World!");
    return mav;
  }
}

Add following code in Dispatcher Servlet XML Configuration File so as to generate caching directives directing client to cache things for 2 minutes before rechecking.

<bean id="sampleController" class="Examples.ExampleController">
<property name="cacheSeconds" value="120"/>
</bean>