zsw-farm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
1.3 KiB

package co.yixiang.config;
import co.yixiang.app.common.interceptor.PermissionInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@Slf4j
public class MvcConfigure implements WebMvcConfigurer {
public HandlerInterceptor getPermissionInterceptor() {
return new PermissionInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(this.getPermissionInterceptor())
.addPathPatterns("/bxgApp/**");
}
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
// 给电商的全部接口增加前缀
configurer.addPathPrefix("/bxgApp",aClass -> aClass.getPackage().getName().startsWith("co.yixiang.app.modules"));
configurer.addPathPrefix("/admin-api/bxg",aClass -> aClass.getPackage().getName().startsWith("co.yixiang"));
}
}