99 - 码云:https://gitee.com/didispace/spring-boot-starter-swagger
1010- 使用样例:https://github.com/dyc87112/swagger-starter-demo
1111- 我的博客:http://blog.didispace.com
12- - 我们社区:http://spring4all.com
12+ - 我们社区:http://www. spring4all.com
1313
1414** 小工具一枚,欢迎使用和Star支持,如使用过程中碰到问题,可以提出Issue,我会尽力完善该Starter**
1515
2727``` xml
2828<dependency >
2929 <groupId >com.spring4all</groupId >
30- <artifactId >spring-boot-starter-swagger </artifactId >
31- <version >1.5.1 .RELEASE</version >
30+ <artifactId >swagger- spring-boot-starter</artifactId >
31+ <version >1.6.0 .RELEASE</version >
3232</dependency >
3333```
3434
35+ ** 注意:从` 1.6.0 ` 开始,我们按Spring Boot官方建议修改了artifactId为` swagger-spring-boot-starter ` ,1.6.0之前的版本不做修改,依然为使用` spring-boot-starter-swagger ` !**
36+
3537- 在应用主类中增加` @EnableSwagger2Doc ` 注解
3638
3739``` java
@@ -97,7 +99,7 @@ swagger.global-response-message.post[0].modelRef=ERROR
9799
98100### 默认配置
99101
100- ```
102+ ``` properties
101103- swagger.enabled =是否启用swagger,默认:true
102104- swagger.title =标题
103105- swagger.description =描述
@@ -153,7 +155,7 @@ swagger.exclude-path=/ops/**, /error
153155
154156具体配置内容如下:
155157
156- ```
158+ ``` properties
157159- swagger.docket.<name>.title =标题
158160- swagger.docket.<name>.description =描述
159161- swagger.docket.<name>.version =版本
@@ -201,7 +203,7 @@ swagger.docket.bbb.basePackage=com.yonghui
201203
202204说明:默认配置与分组配置可以一起使用。在分组配置中没有配置的内容将使用默认配置替代,所以默认配置可以作为分组配置公共部分属性的配置。` swagger.docket.aaa.globalOperationParameters[0].name ` 会覆盖同名的全局配置。
203205
204- ### JSR-303校验注解支持
206+ ### JSR-303校验注解支持(1.5.0 + 支持)
205207
206208支持对JSR-303校验注解的展示,如下图所示:
207209
@@ -214,11 +216,11 @@ swagger.docket.bbb.basePackage=com.yonghui
214216- ` @Size `
215217- ` @Pattern `
216218
217- ### 自定义全局响应消息配置
219+ ### 自定义全局响应消息配置(1.6.0 + 支持)
218220
219221支持 POST,GET,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE 全局响应消息配置,配置如下
220222
221- ``` $xslt
223+ ``` properties
222224// 取消使用默认预定义的响应消息,并使用自定义响应消息
223225swagger.apply-default-response-messages =false
224226swagger.global-response-message.get[0].code =401
@@ -231,6 +233,33 @@ swagger.global-response-message.post[0].message=500post
231233swagger.global-response-message.post[0].modelRef =ERROR
232234```
233235
236+ ### UI功能配置(1.6.0 + 支持)
237+
238+ - 调试按钮的控制(try it out)
239+
240+ ``` properties
241+ swagger.ui-config.submit-methods =get,delete
242+ ```
243+
244+ 该参数值为提供调试按钮的HTTP请求类型,多个用,分割。
245+
246+ 如果不想开启调试功能,只需要如下设置即可:
247+
248+ ``` properties
249+ swagger.ui-config.submit-methods =
250+ ```
251+
252+ - 其他配置
253+
254+ ``` properties
255+ # json编辑器
256+ swagger.ui-config.json-editor =false
257+ # 显示请求头
258+ swagger.ui-config.show-request-headers =true
259+ # 页面调试请求的超时时间
260+ swagger.ui-config.request-timeout =5000
261+ ```
262+
234263## 贡献者
235264
236265- [ 程序猿DD-翟永超] ( https://github.com/dyc87112/ )
0 commit comments