package com.haobang.config;

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;

/**
 * Web MVC配置类
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private ApiKeyInterceptor apiKeyInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 配置API-KEY拦截器，只拦截联动相关的接口
        registry.addInterceptor(apiKeyInterceptor)
                .addPathPatterns("/interlocking/**")
                .excludePathPatterns("/interlocking/health");
    }
}
