SpringWeb 拦截器

Java77

前言

spring拦截器能帮我们实现验证是否登陆、验签校验请求是否合法、预先设置数据等功能,那么该如何设置拦截器以及它的原理如何呢,下面将进行简单的介绍

1.设置

HandlerInterceptor接口

```
public interface HandlerInterceptor {

/**
 * Intercept the execution of a handler. Called after HandlerMapping determined
 * an appropriate handler object, but before HandlerAdapter invokes the handler.
 * <p>DispatcherServlet processes a handler in an execution chain, consisting
 * of any number of interceptors, with the handler itself at the end.
 * With this method, each interceptor can decide to abort the execution chain,
 * typically sending a HTTP error or writing a custom response.
 * </p><p><strong>Note:</strong> special considerations apply for asynchronous
 * request processing. For more details see
输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长