Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
yaru
fgqyxxlr
Commits
72359f3b
Commit
72359f3b
authored
Apr 17, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改系统接口扫描方式
parent
2d580917
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
+11
-3
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
View file @
72359f3b
...
@@ -3,6 +3,7 @@ package com.ruoyi.web.core.config;
...
@@ -3,6 +3,7 @@ package com.ruoyi.web.core.config;
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
com.ruoyi.common.config.Global
;
import
com.ruoyi.common.config.Global
;
import
io.swagger.annotations.ApiOperation
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
...
@@ -28,11 +29,14 @@ public class SwaggerConfig
...
@@ -28,11 +29,14 @@ public class SwaggerConfig
public
Docket
createRestApi
()
public
Docket
createRestApi
()
{
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
//
详细定制
//
用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
.
apiInfo
(
apiInfo
())
.
apiInfo
(
apiInfo
())
// 设置哪些接口暴露给Swagger展示
.
select
()
.
select
()
// 指定当前包路径
// 扫描所有有注解的api,用这种方式更灵活
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.ruoyi.web.controller.tool"
))
.
apis
(
RequestHandlerSelectors
.
withMethodAnnotation
(
ApiOperation
.
class
))
// 扫描指定包中的swagger注解
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
// 扫描所有 .apis(RequestHandlerSelectors.any())
.
paths
(
PathSelectors
.
any
())
.
paths
(
PathSelectors
.
any
())
.
build
();
.
build
();
...
@@ -45,9 +49,13 @@ public class SwaggerConfig
...
@@ -45,9 +49,13 @@ public class SwaggerConfig
{
{
// 用ApiInfoBuilder进行定制
// 用ApiInfoBuilder进行定制
return
new
ApiInfoBuilder
()
return
new
ApiInfoBuilder
()
// 设置标题
.
title
(
"标题:若依管理系统_接口文档"
)
.
title
(
"标题:若依管理系统_接口文档"
)
// 描述
.
description
(
"描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块..."
)
.
description
(
"描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块..."
)
// 作者信息
.
contact
(
new
Contact
(
Global
.
getName
(),
null
,
null
))
.
contact
(
new
Contact
(
Global
.
getName
(),
null
,
null
))
// 版本
.
version
(
"版本号:"
+
Global
.
getVersion
())
.
version
(
"版本号:"
+
Global
.
getVersion
())
.
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