Swagger

访问http://localhost:8080/

如果不想用UI的部分工作,可以使用Swagger。

Swagger需要两个另外的Dependencies。

swagger ui 和 swagger2

@EnableSwagger2

这是项目的可选步骤。

@Bean

public Docket api() {

return new Docket(DocumentationType.SWAGGER_2).select()

.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).paths(PathSelectors.any())

.build().apiInfo(apiInfo()).useDefaultResponseMessages(false);

}

@Bean

public ApiInfo apiInfo() {

final ApiInfoBuilder builder = new ApiInfoBuilder();

return builder.build();

}

相关推荐
PragmaticWorks6 分钟前
从"遍地 try-catch"到分层治理:用 pragmatic-ddd 的异常体系治好代码洁癖
后端·领域驱动设计
苍何21 分钟前
我的开源项目登顶 GitHub 趋势榜 No1 了!
后端
苍何38 分钟前
原来 Agent 量大管饱,真不是吹的
后端
MetaLite1 小时前
SpringBoot分页接口怎么设计-pageSize不设上限会发生什么
java·spring boot·后端
元界metalite1 小时前
SpringBoot整合Redis分布式锁-为什么不能直接DEL
后端
Zane19941 小时前
你以为的性能瓶颈,未必是真的瓶颈:用 cProfile 找到真凶
后端·python
请你吃div1 小时前
Node 后端项目 Docker 自动部署教程(GitHub + 宝塔 + Self-hosted Runner)
后端·docker·node.js
Lovefoolself2 小时前
Electron框架使用vue开发跨平台桌面工具应用-后台日志发送到前台和执行导入ZIP
后端
styshoo2 小时前
[NVSentinel] syslog-health-monitor模块分析
后端
Zane19942 小时前
自定义异常该继承 Exception 还是 RuntimeException,就看这一个问题
java·后端