代码拉取完成,页面将自动刷新
Maven 依赖:
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
配置文件:
public Docket createRestApi() {
return new Docket(DocumentationType.OAS_30)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build();
}
上传代码:
@PostMapping(value = "/upload")
@ApiOperation(value = "上传文件")
public Result<Boolean> upload(@RequestPart(value = "file") MultipartFile file) {
....
}
效果:
官网文档里的方案不管用
文件上传不显示上传选择文本域
Swagger 原生的 UI 是可以正常显示的。
另外,使用 DocumentationType.SWAGGER_2 knife4j是可以显示文本选择域的,
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论