zzw
1 天以前 781b8b3e072a4e00b1cee56f961280c753cbb460
emergency-repair-server/src/main/java/com/emergencyrepair/config/WebConfig.java
@@ -1,11 +1,25 @@
package com.emergencyrepair.config;
import com.emergencyrepair.common.audit.CurrentUserInterceptor;
import org.springframework.context.annotation.Configuration;
import com.emergencyrepair.system.log.OperationLogInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@RequiredArgsConstructor
@Configuration
public class WebConfig implements WebMvcConfigurer {
    private final CurrentUserInterceptor currentUserInterceptor;
    private final OperationLogInterceptor operationLogInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(currentUserInterceptor).addPathPatterns("/api/**").order(0);
        registry.addInterceptor(operationLogInterceptor).addPathPatterns("/api/**");
    }
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/api/**")