|
@@ -11,6 +11,9 @@ import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.web.multipart.MultipartResolver;
|
|
import org.springframework.web.multipart.MultipartResolver;
|
|
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
|
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 项目入口主程序
|
|
* 项目入口主程序
|
|
@@ -39,4 +42,20 @@ public class App {
|
|
resolver.setMaxUploadSize(200*1024*1024);//上传文件大小 50M 50*1024*1024
|
|
resolver.setMaxUploadSize(200*1024*1024);//上传文件大小 50M 50*1024*1024
|
|
return resolver;
|
|
return resolver;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Bean
|
|
|
|
+ public WebMvcConfigurer corsConfigurer() {
|
|
|
|
+ return new WebMvcConfigurerAdapter() {
|
|
|
|
+ public void addCorsMappings(CorsRegistry registry) {
|
|
|
|
+ registry.addMapping("/**");
|
|
|
|
+
|
|
|
|
+// registry.addMapping("/**")
|
|
|
|
+// .allowedOrigins("*")
|
|
|
|
+// .allowedMethods("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE")
|
|
|
|
+// .allowedHeaders("*")
|
|
|
|
+// .exposedHeaders("access_token", "credentials", "refresh_token")
|
|
|
|
+// .allowCredentials(true).maxAge(3600);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ }
|
|
}
|
|
}
|