|
|
@@ -1,6 +1,5 @@
|
|
|
package com.tzld.videoVector;
|
|
|
|
|
|
-import com.tzld.videoVector.interceptor.CrosDomainAllowInterceptor;
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -9,15 +8,17 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
|
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
+/**
|
|
|
+ * CORS 由 K8s Ingress / 阿里云 Tengine 网关统一处理,后端不再重复加 CORS 头,
|
|
|
+ * 否则浏览器会因 Access-Control-Allow-Origin 出现多个值而拦截响应。
|
|
|
+ */
|
|
|
@SpringBootApplication
|
|
|
@MapperScan("com.tzld.videoVector.dao")
|
|
|
@ServletComponentScan("com.tzld.videoVector.controller")
|
|
|
@EnableDiscoveryClient
|
|
|
@EnableFeignClients
|
|
|
-public class Application implements WebMvcConfigurer {
|
|
|
+public class Application {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
|
|
|
|
|
|
@@ -25,9 +26,4 @@ public class Application implements WebMvcConfigurer {
|
|
|
SpringApplication.run(Application.class, args);
|
|
|
LOGGER.info("video-vector-server Start Success");
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public void addInterceptors(InterceptorRegistry registry) {
|
|
|
- registry.addInterceptor(new CrosDomainAllowInterceptor()).addPathPatterns("/**");
|
|
|
- }
|
|
|
}
|