package org.xyzh.common.auth.config;

import java.util.List;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.xyzh.common.auth.annotation.resovler.HttpLoginArgumentResolver;

/**
 * @description    WebMvcConfig.java文件描述 WebMVC配置类
 * @filename    WebMvcConfig.java
 * @author    yslg
 * @copyright yslg
 * @since 2025-11-02
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    
    private final HandlerMethodArgumentResolver httpLoginArgumentResolver;

    /**
     * 使用构造器注入
     * 通过接口抽象解决了循环依赖问题，不再需要@Lazy注解
     */
    public WebMvcConfig(HttpLoginArgumentResolver httpLoginArgumentResolver) {
        this.httpLoginArgumentResolver = httpLoginArgumentResolver;
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(httpLoginArgumentResolver);
    }
}
