swagger使用说明
程序员文章站
2022-07-02 21:06:55
...
swagger使用说明
swagger有不懂的直接看源码 非常简单 不要害怕即可
pom
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>
swagger配置
@Configuration
@PropertySource("classpath:application.properties")
public class Swagger {
@Value("${swagger.flag}")
private boolean flag;
@Bean
public Docket docketRpid(Environment environment){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("rpid")
.enable(flag) //是否启动swagger
.select()
.apis(RequestHandlerSelectors.basePackage("com.hikvision.metro.modules.controller")) //指定扫描的地方
// paths(PathSelectors.ant("/kuang/*")). //过滤路径
.build();
}
@Bean
public Docket docketApi(Environment environment){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("api")
.enable(flag) //是否启动swagger
.select()
.apis(RequestHandlerSelectors.basePackage("com.hikvision.metro.api.v1")) //指定扫描的地方
// paths(PathSelectors.ant("/kuang/*")). //过滤路径
.build();
}
private ApiInfo apiInfo()
{
//作者信息
Contact contact=new Contact("caomingxing6", "", "aaa@qq.com");
//直接进源码抄
return new ApiInfo(
"海康威视公司_rpid项目_接口文档",
"铁路端头入侵接口",
"1.0.0",
"urn:tos",
contact,
"Apache 2.0",
"http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList()
);
}
}
swagger转word —实测很好用
https://www.cnblogs.com/jmcui/p/8298823.html
]
swagger转word —实测很好用
https://www.cnblogs.com/jmcui/p/8298823.html
https://github.com/JMCuixy/swagger2word
上一篇: Swagger
下一篇: Swagger字段属性说明不显示