package com.fzm.mall.server.front.config;

import lombok.RequiredArgsConstructor;
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;

@Configuration
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WebMvcConf implements WebMvcConfigurer {
	
    private final AuthorizationInterceptor authorizationInterceptor;
    private final ApiIdempotentInterceptor apiIdempotentInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authorizationInterceptor).addPathPatterns("/mall/**");

        registry.addInterceptor(apiIdempotentInterceptor).addPathPatterns("/**");
    }
}

