atools -> log -> interceptor -> MyInterceptor 文件
package com.example.demo.atools.log.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @Create: IntelliJ IDEA. * @Author: subtlman_ljx * @Date: 2020/09/09/9:22 * @Description: 处理拦截的请求 */ @Component public class MyInterceptor implements HandlerInterceptor { Logger logger = LoggerFactory.getLogger(MyInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HttpSession session = request.getSession(); //这里对请求资源做处理,返回true或者false TODO logger.info("url拦截,拦截器被调用了。。。。。"); return true; } }
标签:log,atools,MyInterceptor,org,import,interceptor From: https://www.cnblogs.com/subtlman/p/16638158.html