Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
admin
Project
Project
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
曲欣亮
admin
Commits
34d39279
Commit
34d39279
authored
Aug 28, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d31428f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
35 deletions
+48
-35
SwaggerConfig.java
src/main/java/com/egolm/admin/config/SwaggerConfig.java
+48
-35
No files found.
src/main/java/com/egolm/admin/config/SwaggerConfig.java
View file @
34d39279
package
com
.
egolm
.
admin
.
config
;
package
com
.
egolm
.
admin
.
config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.request.async.DeferredResult
;
import
com.egolm.common.DateUtil
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.PathSelectors
;
...
@@ -9,27 +13,36 @@ import springfox.documentation.builders.RequestHandlerSelectors;
...
@@ -9,27 +13,36 @@ import springfox.documentation.builders.RequestHandlerSelectors;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@Configuration
@EnableSwagger2
public
class
SwaggerConfig
{
public
class
SwaggerConfig
{
@Value
(
"${server.servlet.context-path}"
)
private
String
contextPath
;
@Value
(
"${maven.build.timestamp}"
)
private
String
mavenBuildTime
;
@Bean
@Bean
public
Docket
createRestApi
()
{
public
Docket
ProductApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
genericModelSubstitutes
(
DeferredResult
.
class
)
.
useDefaultResponseMessages
(
false
)
.
forCodeGeneration
(
false
)
.
pathMapping
(
"/"
)
.
select
()
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.egolm.admin"
))
.
build
()
.
paths
(
PathSelectors
.
any
())
.
apiInfo
(
productApiInfo
());
.
build
();
}
}
private
ApiInfo
apiInfo
()
{
private
ApiInfo
productApiInfo
()
{
String
releaseTime
=
DateUtil
.
formatTimeEight
(
mavenBuildTime
.
replace
(
"T"
,
" "
).
replace
(
"Z"
,
""
));
return
new
ApiInfoBuilder
()
return
new
ApiInfoBuilder
()
.
title
(
"B2B运营平台服务"
)
.
title
(
"B2B后台在线接口服务-------"
+
contextPath
+
"---发布时间:-"
+
releaseTime
)
.
description
(
"在线文档"
)
.
termsOfServiceUrl
(
"NO terms of service"
)
.
termsOfServiceUrl
(
"NO terms of service"
)
.
version
(
"1.0"
)
.
version
(
"1.0"
)
.
build
();
.
build
();
}
}
}
}
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