Blame view

src/main/java/com/huaheng/framework/token/WebAppConfigurer.java 844 Bytes
mahuandong authored
1
2
3
4
5
6
7
8
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;

/**
mahuandong authored
9
10
11
 * api拦截器
 * @author Enzo Cotter
 * @date 2020/6/11
mahuandong authored
12
13
14
15
16
17
18
19
20
21
22
 */
@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {

    @Bean
    ApiInterceptor apiInterceptor(){return new ApiInterceptor();}

    @Override
    public void addInterceptors(InterceptorRegistry interceptorRegistry) {
        interceptorRegistry.addInterceptor(apiInterceptor())
                .addPathPatterns("/api/**")
游杰 authored
23
24
                .excludePathPatterns("/api/getToken")
                .excludePathPatterns("/api/getTokenForMobile");
mahuandong authored
25
26
    }
}