1、创建自定义拦截器xxxIntercepter implements HandlerIntercepter

2、重写HandlerIntercepter的preHandle、postHandle、afterComplate方法。在preHandle方法中可以通过request参数获取session,请求接口路径等信息。可以在此进行统一请求日志记录、鉴权、session处理等

3、创建配置类 xxxConfig extends WebMvcConfigurationSupport,并加上@Configuration

网友评论