WebSecurityConfig.java 784 B

123456789101112131415161718192021222324
  1. package com.yaozhitech.spring5.config;
  2. import org.springframework.context.annotation.Bean;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.web.servlet.HandlerInterceptor;
  5. import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
  6. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  7. import com.yaozhitech.spring5.intercept.ServiceAuthRestInterceptor;
  8. @Configuration
  9. public class WebSecurityConfig implements WebMvcConfigurer{
  10. @Bean
  11. public HandlerInterceptor serviceAuthRestInterceptor() {
  12. return new ServiceAuthRestInterceptor();
  13. }
  14. @Override
  15. public void addInterceptors(InterceptorRegistry registry) {
  16. registry.addInterceptor(serviceAuthRestInterceptor());
  17. }
  18. }