WebConfig.java 895 Bytes
package com.gsc4cloud.agentmanage.config;

import com.gsc4cloud.agentmanage.interceptor.SessionInterceptor;
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;

/**
 * @Description todo
 * @Author yelq
 * @Date 2025/7/28-15:37
 * @Version 1.0
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private SessionInterceptor sessionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sessionInterceptor)
                .addPathPatterns("/**") // 拦截所有路径
        /*.excludePathPatterns("/login", "/error")*/; // 排除不需要拦截的路径
    }
}