WebAppConfigurer.java
826 Bytes
package com.huaheng.framework.token;
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;
/**
* Created by Enzo Cotter on 2020/6/11.
*/
@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {
@Bean
ApiInterceptor apiInterceptor(){return new ApiInterceptor();}
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
interceptorRegistry.addInterceptor(apiInterceptor())
.addPathPatterns("/api/**")
.excludePathPatterns("/api/getToken")
.excludePathPatterns("/api/getTokenForMobile");
}
}