package com.ruoyi.framework.config;

import com.ruoyi.framework.interceptor.LoginApiInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {

    @Resource
    private LoginApiInterceptor loginApiInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截小程序接口
        registry.addInterceptor(loginApiInterceptor)
                .addPathPatterns("/api/**")
                //放行的接口
                .excludePathPatterns("/**/login");

    }


}
