InterceptorConfig.java 955 B

1234567891011121314151617181920212223242526272829
  1. package com.huimv.admin.config;
  2. import org.springframework.context.annotation.Bean;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
  5. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  6. /**
  7. * @Description: 注册验证tocken的拦截器
  8. * @Author
  9. * @Date 2021/4/19 20:41
  10. * @Version V1.0
  11. */
  12. @Configuration
  13. public class InterceptorConfig implements WebMvcConfigurer {
  14. @Bean
  15. public JWTInterceptor jwtInterceptor(){
  16. return new JWTInterceptor();
  17. }
  18. @Override
  19. public void addInterceptors(InterceptorRegistry registry) {
  20. registry.addInterceptor(jwtInterceptor()).
  21. excludePathPatterns("/*/my/*").
  22. excludePathPatterns(("/env-electricity/testList")).
  23. excludePathPatterns("/env-water/testList").
  24. excludePathPatterns("/envDevice/getList");
  25. }
  26. }