其他分享
首页 > 其他分享> > 关于HandlerInterceptorAdapter和WebMvcConfigurerAdapter过时

关于HandlerInterceptorAdapter和WebMvcConfigurerAdapter过时

作者:互联网

修改成这样

@Configuration
public class HeaderTokenInterceptor implements WebMvcConfigurer {

    @Autowired
    SecurityInterceptor securityInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration adminInterceptor = registry.addInterceptor(securityInterceptor);
        adminInterceptor.excludePathPatterns("/admin/login")
                .excludePathPatterns("/adminlogs/log")
                .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
        //拦截所有路径
        adminInterceptor.addPathPatterns("/admin/**");
    }

}
@Configuration
public class SecurityInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
}

标签:过时,HandlerInterceptorAdapter,excludePathPatterns,adminInterceptor,securityInterc
来源: https://www.cnblogs.com/Slience-me/p/16341836.html