Advertisement

springboot拦截器

阅读量:
  1. 创建我们自己的拦截器类

实现 HandlerInterceptor 接口

package com.gary.interseptor;
/**

  • 全局流量拦截器:基于Request.class和Response.class的全局流量控制
    */
    import javax.annotation.Resource;
    import javax.servlet.http.Request.class;
    import javax.servlet.http.Response.class;

import com.gary.exception.CustomException;
import com.gary.exception.ErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframew

全部评论 (0)

还没有任何评论哟~