- 前端接口拦截器(列出分析)
<!-- 前端接口拦截器 --> <mvc:interceptors> <mvc:interceptor> <!-- 匹配路径所有路径 --> <mvc:mapping path="/**"/> <!-- 登录接口不验证 --> <mvc:exclude-mapping path="/api/user/*"/><!-- 用户登录地址 --> <mvc:exclude-mapping path="/api/index.htm"/><!-- API注解访问地址--> <mvc:exclude-mapping path="/**/**/**/*.css.htm"/><!-- swagger静态资源--> <mvc:exclude-mapping path="/**/**/**/*.js.htm"/><!-- swagger静态资源--> <mvc:exclude-mapping path="/api.htm"/><!-- 请求所有api的接口--> <mvc:exclude-mapping path="/api/scene/dataReport.htm"/><!--数据上报不拦截--> <mvc:exclude-mapping path="/api/upload/fileUpload.htm"/><!--文件上传接口--> <!-- 拦截器类 --> <bean class="com.xxx.interceptor.RequestInterceptor"></bean> </mvc:interceptor> </mvc:interceptors>
拦截器很明显在com.xxx.interceptor.RequestInterceptor
访问接口时想要某接口不走拦截器,/api/upload/fileUpload.htm,将ip:端口后的URL复制,该接口exclude-mapping就不匹配,相当于直接返回了个true。
Spring MVC拦截器使用
最新推荐文章于 2024-06-16 13:55:02 发布