@Configuration public class InterceptorConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(authenticationInterceptor()) .addPathPatterns("/**"); // 拦截所有请求,通过判断是否有 @LoginRequired 注解 决定是否需要登录 } @Bean public FeignAuthenticationInterceptor authenticationInterceptor() { return new FeignAuthenticationInterceptor(); } }
InterceptorConfig
最新推荐文章于 2023-08-08 11:21:48 发布