|
|
@@ -0,0 +1,23 @@
|
|
|
+package com.sckw.core.web.config;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author czh
|
|
|
+ * @desc 跨域访问配置
|
|
|
+ * @date 2023/7/6
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
+
|
|
|
+ public void addCorsMappings(CorsRegistry registry) {
|
|
|
+ registry.addMapping("/**")
|
|
|
+ .allowedOriginPatterns("*")
|
|
|
+ .allowCredentials(true)
|
|
|
+ .allowedMethods("GET", "HEAD", "POST","PUT", "DELETE", "OPTIONS")
|
|
|
+ .maxAge(3600);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|