Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-job
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
cloud-job
Commits
2a7704a8
Commit
2a7704a8
authored
Oct 30, 2024
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SwaggerConfig
parent
c04b0b82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
+4
-1
cloud-job-service/src/main/java/com/yizhi/application/config/SwaggerConfig.java
+4
-1
No files found.
cloud-job-service/src/main/java/com/yizhi/application/config/SwaggerConfig.java
View file @
2a7704a8
package
com
.
yizhi
.
application
.
config
;
package
com
.
yizhi
.
application
.
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.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -18,6 +19,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -18,6 +19,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@EnableSwagger2
public
class
SwaggerConfig
extends
WebMvcConfigurerAdapter
{
public
class
SwaggerConfig
extends
WebMvcConfigurerAdapter
{
@Value
(
"${swagger.enabled}"
)
private
boolean
swaggerEnabled
;
/**
/**
* 这个地方要重新注入一下资源文件,不然不会注入资源的,也没有注入requestHandlerMappping,相当于xml配置的
* 这个地方要重新注入一下资源文件,不然不会注入资源的,也没有注入requestHandlerMappping,相当于xml配置的
* <!--swagger资源配置-->
* <!--swagger资源配置-->
...
@@ -37,7 +40,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter{
...
@@ -37,7 +40,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter{
@Bean
@Bean
public
Docket
createRestApi
()
{
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
enable
(
swaggerEnabled
)
.
select
()
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.yizhi.application"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.yizhi.application"
))
.
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