springboot中使用swagger生成接口文档并配置bootstrap主题
引入依赖
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.6.Final</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
配置
@Configuration
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.laifeng"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("校车系统")
.contact(new Contact("耿明硕", "", "3230630470@qq.com"))
.version("1.0")
.build();
}
}
使用
可以看这篇文档,有注解说明:https://blog.csdn.net/xiaojin21cen/article/details/78654652
查看bootstrap主题的话地址是:http://localhost:8080/doc.html
默认swagger主题的地址是:http://localhost:8080/swagger-ui.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)