33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
![]() |
package com.imooc.config;
|
||
|
|
||
|
import com.imooc.intercepter.PassportInterceptor;
|
||
|
import com.imooc.intercepter.UserTokenInterceptor;
|
||
|
import org.springframework.context.annotation.Bean;
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||
|
|
||
|
@Configuration
|
||
|
public class InterceptorConfig implements WebMvcConfigurer {
|
||
|
|
||
|
@Bean
|
||
|
public PassportInterceptor passportInterceptor() {
|
||
|
return new PassportInterceptor();
|
||
|
}
|
||
|
|
||
|
@Bean
|
||
|
public UserTokenInterceptor userTokenInterceptor() {
|
||
|
return new UserTokenInterceptor();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||
|
registry.addInterceptor(passportInterceptor())
|
||
|
.addPathPatterns("/passport/getSMSCode");
|
||
|
|
||
|
registry.addInterceptor(userTokenInterceptor())
|
||
|
.addPathPatterns("/userInfo/modifyUserInfo")
|
||
|
.addPathPatterns("/userInfo/modifyImage");
|
||
|
}
|
||
|
}
|