Implements the feature which count how long a request will be processed by controller method using interceptor in Spring MVC.
There's no changes in interceptor if you use java config. The only change compared with XML is to register interceptor in WebAplicationContextConfig class instead of XML.
Here is the code to config using Java class:
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new ProcessingTimeLogInterceptor());
}
source code link: https://github.com/TinaXing2012/Spring/tree/master/SpringValidationXML
Download
0 formats
No download links available.
48. Interceptor in Spring MVC Coding Step by Step | NatokHD