1313
1414# 版本基础
1515
16- - Swagger:2.9 .2
16+ - Swagger:3.0 .2
1717
1818# 如何使用
1919
2525<dependency >
2626 <groupId >com.spring4all</groupId >
2727 <artifactId >swagger-spring-boot-starter</artifactId >
28- <version >1.9.1 .RELEASE</version >
28+ <version >2.0.0 .RELEASE</version >
2929</dependency >
3030```
3131
32- ** 注意:从 ` 1.6.0 ` 开始,我们按Spring Boot官方建议修改了artifactId为 ` swagger-spring-boot-starter ` ,1.6.0之前的版本不做修改,依然为使用 ` spring-boot-starter-swagger ` ! **
32+ ** 注意
3333
34- - 在应用主类中增加` @EnableSwagger2Doc ` 注解
35-
36- ``` java
37- @EnableSwagger2Doc
38- @SpringBootApplication
39- public class Bootstrap {
40-
41- public static void main (String [] args ) {
42- SpringApplication . run(Bootstrap . class, args);
43- }
44-
45- }
46- ```
34+ 1 . 从` 1.6.0 ` 开始,我们按Spring Boot官方建议修改了artifactId为` swagger-spring-boot-starter ` ,1.6.0之前的版本不做修改,依然为使用` spring-boot-starter-swagger ` !**
35+ 2 . 从` 2.0.0 ` 开始,不再需要手工添加` @EnableSwagger2Doc ` 来启动Swagger配置
4736
4837默认情况下就能产生所有当前Spring MVC加载的请求映射文档。
4938
@@ -54,7 +43,7 @@ public class Bootstrap {
5443## 配置示例
5544
5645``` properties
57- swagger .enabled =true
46+ springfox.documentation .enabled =true
5847
5948swagger.title =spring-boot-starter-swagger
6049swagger.description =Starter for swagger 2.x
@@ -97,7 +86,7 @@ swagger.global-response-message.post[0].modelRef=ERROR
9786### 默认配置
9887
9988``` properties
100- - swagger .enabled =是否启用swagger,默认:true
89+ - springfox.documentation .enabled =是否启用swagger,默认:true
10190- swagger.title =标题
10291- swagger.description =描述
10392- swagger.version =版本
@@ -118,12 +107,15 @@ swagger.global-response-message.post[0].modelRef=ERROR
118107- swagger.globalOperationParameters[0].required =指定参数是否必传,true,false
119108```
120109
121-
122110> ` 1.3.0.RELEASE ` 新增:` swagger.host ` 属性,同时也支持指定docket的配置
123111>
124112> ` 1.4.0.RELEASE ` 新增:
125113> - ` swagger.enabled ` :用于开关swagger的配置
126114> - ` swagger.globalOperationParameters ` :用于设置全局的参数,比如:header部分的accessToken等。该参数支持指定docket的配置。
115+ >
116+ > ` 2.0.0.RELEASE ` 调整:
117+ > - 原来的` swagger.enabled ` 配置修改为` springfox.documentation.enabled ` 来控制
118+
127119
128120### Path规则说明
129121
@@ -349,10 +341,3 @@ private List<SecurityReference> defaultAuth() {
349341 .scopes(authorizationScopes). build());
350342}
351343```
352-
353- ## 贡献者
354-
355- - [ 程序猿DD-翟永超] ( https://github.com/dyc87112/ )
356- - [ 小火] ( https://renlulu.github.io/ )
357- - [ 泥瓦匠BYSocket] ( https://github.com/JeffLi1993 )
358- - [ LarryKoo-古拉里] ( https://github.com/gumutianqi )
0 commit comments