Esto eliminará la página "common-swagger 使用说明"
. Por favor, asegúrate de que es lo que quieres.
swagger版本: 2.7.0
<dependency>
<groupId>com.yihu.jw</groupId>
<artifactId>common-swagger</artifactId>
<version>${版本以项目中最新的版本为主}</version>
</dependency>
@Configuration
@EnableSwagger2 //开启swagger配置
public class SwaggerConfig {
public static final String default_API = "default";
@Bean
public Docket defaultAPI() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName(default_API)
.useDefaultResponseMessages(false)
.forCodeGeneration(false)
.pathMapping("/") //默认从根目录开始扫描
.select()
.paths(or(
regex("/.*") //扫描的路径
))
.build()
.apiInfo(defaultApiInfo());
}
private ApiInfo defaultApiInfo() {
ApiInfo apiInfo = new ApiInfo("API", //大标题
"API,提供基础服务。", //描述
"1.0",//版本号
"No terms of service",//服务的url
"wenfujian@jkzl.com",// 联系人
"The Apache License, Version 2.0", //许可证
"http://www.apache.org/licenses/LICENSE-2.0.html" //许可证url
);
return apiInfo;
}
}
@Controller
@RequestMapping(value = "/demo",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "健康教育文章类") //添加swagger中类的注释
public class EduArticleController extends BaseController{
@RequestMapping(value = "/getById",method = RequestMethod.POST)
@ResponseBody
@ApiOperation("获取文章详情") //添加swagger中函数的注释
public ResultOneModel<ArticleModel> getById(
//添加swagger中入参的注释 name是名字 value是中文注释
@ApiParam(name = "articleId",value = "文章ID")@RequestParam(value = "articleId")String articleId){
}
}
Esto eliminará la página "common-swagger 使用说明"
. Por favor, asegúrate de que es lo que quieres.