Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
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
曲欣亮
shop
Commits
2007e1a9
Commit
2007e1a9
authored
Apr 04, 2023
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加swagger-ui开关
parent
073c4d21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
SwaggerConfig.java
...main/java/com/egolm/shop/common/config/SwaggerConfig.java
+5
-2
No files found.
src/main/java/com/egolm/shop/common/config/SwaggerConfig.java
View file @
2007e1a9
...
@@ -3,6 +3,7 @@ package com.egolm.shop.common.config;
...
@@ -3,6 +3,7 @@ package com.egolm.shop.common.config;
import
org.springframework.beans.factory.annotation.Value
;
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.context.annotation.Profile
;
import
org.springframework.web.context.request.async.DeferredResult
;
import
org.springframework.web.context.request.async.DeferredResult
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.DateUtil
;
...
@@ -19,10 +20,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -19,10 +20,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@Configuration
@EnableSwagger2
@EnableSwagger2
public
class
SwaggerConfig
{
public
class
SwaggerConfig
{
@Value
(
"${swagger2.enable:false}"
)
private
boolean
enableSwagger
;
@Bean
@Bean
public
Docket
createRestApi
()
{
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
select
()
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
enable
(
enableSwagger
).
select
()
.
apis
(
RequestHandlerSelectors
.
withMethodAnnotation
(
ApiOperation
.
class
)).
paths
(
PathSelectors
.
any
())
.
apis
(
RequestHandlerSelectors
.
withMethodAnnotation
(
ApiOperation
.
class
)).
paths
(
PathSelectors
.
any
())
.
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