配置拦截器,redis

This commit is contained in:
Cool 2024-07-05 15:08:19 +08:00
parent 71bb8cdab6
commit b70501c750
2 changed files with 3 additions and 6 deletions

View File

@ -17,17 +17,12 @@ public class InterceptorConfig implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) {//配置拦截器 public void addInterceptors(InterceptorRegistry registry) {//配置拦截器
System.out.println("拦截器被配置了");
ArrayList<String> excludePath = new ArrayList<>(); ArrayList<String> excludePath = new ArrayList<>();
excludePath.add("/login");//登录 excludePath.add("/login");//登录
excludePath.add("/checkCode");
excludePath.add("/sendCode");
excludePath.add("/register");//注册 excludePath.add("/register");//注册
excludePath.add("/apiSend"); excludePath.add("/apiSend");
excludePath.add("/timeChange"); excludePath.add("/timeChange");
excludePath.add("/timeGet"); excludePath.add("/timeGet");
excludePath.add("/index/modifyHead");
registry.addInterceptor(tokenInterceptor)//注册拦截器 registry.addInterceptor(tokenInterceptor)//注册拦截器
.addPathPatterns("/**")//拦截所有请求 .addPathPatterns("/**")//拦截所有请求
.excludePathPatterns(excludePath);//添加拦截白名单 .excludePathPatterns(excludePath);//添加拦截白名单

View File

@ -2,9 +2,11 @@ spring:
application: application:
name: AITest name: AITest
redis: redis:
port: 6379 port: 6379
# password: ob666666 # password: ob666666
host: localhost host: 49.233.248.140
password: aB3cDeF9
datasource: datasource:
username: root username: root
password: 3534957771fb4925 password: 3534957771fb4925