代码拉取完成,页面将自动刷新
package org.example.annotation;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 应用配置
*
* @author wangMaoXiong
* @version 1.0
* @date 2021/8/25 9:13
*/
@Configuration
public class AppConfig implements WebMvcConfigurer {
/**
* 注册拦截器
* .addPathPatterns("/**"):表示拦截整个应用中的所有请求
* .excludePathPatterns(String... patterns):表示排除这些规则的请求,不对它们进行拦截
* <p>
* spring Boot 2 以后,静态资源也会被拦截.
* classpath:/META‐INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/"下的资源也会被拦截
* 通常静态资源可以不需要进行拦截,可以对它们直接进行放行
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new AppInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/user/index")
.excludePathPatterns("/webjars/**", "/css/**/*.css", "/js/**/*.js", "/fonts/**", "/images/**");
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。