HandlerInterceptor
interface forces to implement all the three methods preHandle()
, postHandle()
and afterCompletion()
irrespective of whether it is needed or not. To avoid that, you can use HandlerInterceptorAdapter
class that implements HandlerInterceptor and provides default empty implementations. Extending HandlerInterceptorAdapter
class allows you to override only the method that are required.