Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
map-parent
Commits
29455489
Commit
29455489
authored
Mar 18, 2021
by
chentian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imageapi基础配置
parent
581d5bcf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
pom.xml
+1
-1
service/asj/src/main/java/com/founder/asj/config/CorsConfig.java
+35
-0
service/asj/src/test/java/com/founder/demo/CodeGenerator.java
+1
-1
No files found.
pom.xml
View file @
29455489
...
...
@@ -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>
...
...
service/asj/src/main/java/com/founder/asj/config/CorsConfig.java
0 → 100644
View file @
29455489
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
service/asj/src/test/java/com/founder/demo/CodeGenerator.java
View file @
29455489
...
...
@@ -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
);
//生成后是否打开资源管理器
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment