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();

}

相关推荐
geovindu27 分钟前
CSharp: Observer Pattern
开发语言·后端·观察者模式·设计模式·c#·.netcore·行为模式
Flynt1 小时前
把公司项目迁到 Spring Boot 4.0:编译通过只是开始
java·spring boot·后端
IT_陈寒1 小时前
Redis误用keys命令把生产环境搞崩了,血的教训
前端·人工智能·后端
她的男孩2 小时前
多租户和数据权限怎么共存?扒完拦截器注册链路,我找到 4 个隐蔽的坑
java·后端·架构
用户8356290780512 小时前
使用 Python 设置 Excel 页眉和页脚
后端·python
步行cgn2 小时前
IoC 控制反转:从概念到 Spring 的实现
后端
爱勇宝2 小时前
没有 Fn 键关触控板?我做了一个双击即用的 Windows 小工具
前端·后端·程序员
沙湖遇雨3 小时前
8.ByteBuf 的数据模型、生命周期和内存分配
后端
by组态3 小时前
Ricon组态系统API参考手册
前端·后端·物联网