Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
chenjunxiong
guns-vip
Commits
2cbe1a11
Commit
2cbe1a11
authored
Jun 01, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改swagger扫描方式为注解扫描
parent
bc644448
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
src/main/java/com/stylefeng/guns/config/SwaggerConfig.java
+4
-2
src/main/java/com/stylefeng/guns/modular/system/controller/CodeController.java
+2
-1
src/main/resources/application.yml
+1
-1
No files found.
src/main/java/com/stylefeng/guns/config/SwaggerConfig.java
View file @
2cbe1a11
package
com
.
stylefeng
.
guns
.
config
;
package
com
.
stylefeng
.
guns
.
config
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -27,14 +28,15 @@ public class SwaggerConfig{
...
@@ -27,14 +28,15 @@ public class SwaggerConfig{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
apiInfo
(
apiInfo
())
.
select
()
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.stylefeng.guns.modular.system.controller"
))
.
apis
(
RequestHandlerSelectors
.
withMethodAnnotation
(
ApiOperation
.
class
))
//这里采用包含注解的方式来确定要显示的接口
//.apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.modular.system.controller")) //这里采用包扫描的方式来确定要显示的接口
.
paths
(
PathSelectors
.
any
())
.
paths
(
PathSelectors
.
any
())
.
build
();
.
build
();
}
}
private
ApiInfo
apiInfo
()
{
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
return
new
ApiInfoBuilder
()
.
title
(
"Guns
RESTful APIs
"
)
.
title
(
"Guns
Doc
"
)
.
description
(
"Guns Api文档"
)
.
description
(
"Guns Api文档"
)
.
termsOfServiceUrl
(
"http://git.oschina.net/naan1993/guns"
)
.
termsOfServiceUrl
(
"http://git.oschina.net/naan1993/guns"
)
.
contact
(
"stylefeng"
)
.
contact
(
"stylefeng"
)
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/CodeController.java
View file @
2cbe1a11
...
@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiImplicitParams;
...
@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiImplicitParams;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
/**
...
@@ -43,7 +44,7 @@ public class CodeController extends BaseController {
...
@@ -43,7 +44,7 @@ public class CodeController extends BaseController {
@ApiImplicitParam
(
name
=
"bizEnName"
,
value
=
"业务英文名称"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"bizEnName"
,
value
=
"业务英文名称"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"path"
,
value
=
"项目生成类路径"
,
required
=
true
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"path"
,
value
=
"项目生成类路径"
,
required
=
true
,
dataType
=
"String"
)
})
})
@RequestMapping
(
value
=
"/generate"
)
@RequestMapping
(
value
=
"/generate"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Object
add
(
String
bizChName
,
String
bizEnName
,
String
path
)
{
public
Object
add
(
String
bizChName
,
String
bizEnName
,
String
path
)
{
if
(
ToolUtil
.
isOneEmpty
(
bizChName
,
bizEnName
))
{
if
(
ToolUtil
.
isOneEmpty
(
bizChName
,
bizEnName
))
{
...
...
src/main/resources/application.yml
View file @
2cbe1a11
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
################### guns配置 ###################
################### guns配置 ###################
guns
:
guns
:
swagger-open
:
fals
e
#是否开启swagger (true/false)
swagger-open
:
tru
e
#是否开启swagger (true/false)
kaptcha-open
:
false
#是否开启登录时验证码 (true/false)
kaptcha-open
:
false
#是否开启登录时验证码 (true/false)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
#file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录)
...
...
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