当前位置:网站首页>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());
}
边栏推荐
- Four operations in TF
- Activity的四种状态
- 1.2 - error sources
- Serverless + domain name can also build a personal blog? Really, and soon
- 【LeetCode】Summary of linked list problems
- Interaction of Pico neo3 in Unity
- 1051 Multiplication of Complex Numbers (15 points)
- TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
- 1061 判断题 (15 分)
- 测试用例很难?有手就行
猜你喜欢

1002 写出这个数 (20 分)

关于#sql#的问题:怎么将下面的数据按逗号分隔成多行,以列的形式展示出来

测试用例很难?有手就行

Do you know the basic process and use case design method of interface testing?

Machine Learning Summary (2)

matrix multiplication in tf

1036 Programming with Obama (15 points)

Distributed Lock-Redission - Cache Consistency Solution

查询跟踪快递单号物流,智能分析物流中转有延误的单号

leetcode:69. x 的平方根
随机推荐
go-grpc TSL authentication solution transport: authentication handshake failed: x509 certificate relies on ... ...
CSDN21天学习挑战赛——封装(06)
1.1-回归
1106 2019数列 (15 分)
Tf中的平方,多次方,开方计算
TF generates (feature, label) set through feature and label, tf.data.Dataset.from_tensor_slices
查找最新人员工资和上上次人员工资的变动情况
1002 Write the number (20 points)
1002 写出这个数 (20 分)
1046 punches (15 points)
Analysys and the Alliance of Small and Medium Banks jointly released the Hainan Digital Economy Index, so stay tuned!
8、Mip-NeRF
1091 N-Defensive Number (15 points)
About # SQL problem: how to set the following data by commas into multiple lines, in the form of column display
tf.cast(),reduce_min(),reduce_max()
【BM87 合并两个有序的数组】
Keep track of your monthly income and expenses through bookkeeping
进阶-指针
Service的两种状态形式
【Day_13 0509】▲跳石板