当前位置:网站首页>Swagger简单使用
Swagger简单使用
2022-08-11 07:42:00 【风铃峰顶】
Swagger的Controller可以写@Api(tags = “导航名”),会显示在Swagger网页左侧导航里,下拉可以看到里面的接口。@ApiOperation(“接口名”)。
@ApiVersion({版本号,版本号})。在Swagger网页左侧上面搜索栏里可以搜索版本号。
@Configuration
@EnableSwagger2WebMvc
public class DocConfig implements InitializingBean {
private final OpenApiExtensionResolver openApiExtensionResolver;
@Autowired
private ApplicationContext applicationContext;
@Autowired
public DocConfig(OpenApiExtensionResolver openApiExtensionResolver) {
this.openApiExtensionResolver = openApiExtensionResolver;
}
@Bean
public Docket createBusinessRestApi() {
String groupName = "";
ApiInfo businessApiInfo = new ApiInfoBuilder()
.title(groupName)
.description("")
.contact(new Contact("", "", ""))
.version("1.0")
.build();
return new Docket(DocumentationType.SWAGGER_2)
.groupName(groupName)
.apiInfo(businessApiInfo)
// 设置统一参数,如Header中的参数
.globalOperationParameters(params())
.select()
.apis(RequestHandlerSelectors.basePackage(""))
.paths(PathSelectors.any())
.build()
.extensions(openApiExtensionResolver.buildExtensions(groupName));
}
private List<Parameter> params() {
ParameterBuilder tokenParam = new ParameterBuilder();
tokenParam.name("token").description("Token")
.modelRef(new ModelRef("string")).parameterType("header").required(false).build();
}
return Lists.newArrayList(tokenParam.build());
}
边栏推荐
- 1101 How many times B is A (15 points)
- 1051 Multiplication of Complex Numbers (15 points)
- Do you know the basic process and use case design method of interface testing?
- 1056 组合数的和 (15 分)
- Keep track of your monthly income and expenses through bookkeeping
- Kaldi语音识别工具编译问题记录(踩坑记录)
- 支持各种文件快速重命名最简单的小技巧
- matrix multiplication in tf
- AcWing 272. 最长公共上升子序列
- 1061 判断题 (15 分)
猜你喜欢

Active users of mobile banking grew rapidly in June, hitting a half-year high

tf.reduce_mean() and tf.reduce_sum()

Tensorflow中使用tf.argmax返回张量沿指定维度最大值的索引

Decrement operation in tf; tf.assign_sub()

Item 2 - Annual Income Judgment
几何EX3 功夫牛宣布停售,入门级纯电产品为何总成弃子

1076 Wifi密码 (15 分)

机器学习总结(二)

接口测试的基础流程和用例设计方法你知道吗?

Redis source code-String: Redis String command, Redis String storage principle, three encoding types of Redis string, Redis String SDS source code analysis, Redis String application scenarios
随机推荐
Square, multi-power, square root calculation in Tf
1056 组合数的和 (15 分)
数据库无法启动,报无法分配内存,怎么处理
选择收银系统主要看哪些方面?
囍楽云任务源码
oracle19c不支持实时同步参数,请教一下大佬们有什么好的解决办法吗?
Evolution and New Choice of Streaming Structured Data Computing Language
1076 Wifi Password (15 points)
软件测试常用工具的用途及优缺点比较(详细)
Serverless + domain name can also build a personal blog? Really, and soon
The easiest trick to support quick renaming of various files
string类接口介绍及应用
9、Neural Sparse Voxel Fields
Two state forms of Service
抽象类和接口
2022-08-10 mysql/stonedb-slow SQL-Q16-time-consuming tracking
tf.cast(), reduce_min(), reduce_max()
接口测试的基础流程和用例设计方法你知道吗?
oracle19c does not support real-time synchronization parameters, do you guys have any good solutions?
无服务器+域名也能搭建个人博客?真的,而且很快