Commit 29455489 by chentian

imageapi基础配置

parent 581d5bcf
......@@ -52,7 +52,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RELEASE</version>
<version>Finchley.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
......
package com.founder.asj.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
* Created by changc on 2018/9/7.
*
允许任何域名使用
允许任何头
允许任何方法(post、get等)
*/
@Configuration
public class CorsConfig {
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*"); // 1
corsConfiguration.addAllowedHeader("*"); // 2
corsConfiguration.addAllowedMethod("*"); // 3
corsConfiguration.setAllowCredentials(true);
return corsConfiguration;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig()); // 4
return new CorsFilter(source);
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ public class CodeGenerator {
// 2、全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir("F:\\MyProject\\map-parent\\service\\es" + "/src/main/java");//生成路径
gc.setOutputDir("D:\\MyProject\\map-parent\\serviceapi\\imagrapi" + "/src/main/java");//生成路径
gc.setAuthor("chent");//作者
gc.setOpen(false); //生成后是否打开资源管理器
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment