1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
@Slf4j
@Component
public class TransactionLogInterceptor implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
HandlerMethod handlerMethod = (HandlerMethod) handler;
ApiOperation methodAnnotation = handlerMethod.getMethodAnnotation(LogHandle.class);
if (methodAnnotation != null){
Method method = handlerMethod.getMethod();
log.info("{}-{}", method.getName(), methodAnnotation.value());
}
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}
|