- Docket
- DocumentationType
- ApiInfo
@Configuration
@EnableSwagger2 //开启swagger2
public class SwaggerConfig {
//配置Swagger的Docket的bean实例
@Bean
public Docket docket(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo());
}
//配置swagger信息=apiInfo
private ApiInfo apiInfo(){
//作者信息
Contact contact = new Contact("测试", "http://localhost:8080/swagger-ui.html#/", "260474420@qq.com");
return new ApiInfo(
"Api 文档标题",
"Api文档描述",
"v1.0",
"urn:tos", contact,
"Apache 2.0",
"http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList());
}
}