首页 > 其他分享 >swagger2.0

swagger2.0

时间:2023-05-08 17:33:38浏览次数:31  
标签:notes swagger2.0 2.9 apiInfo io springfox

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.6</version>
<relativePath/>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

@Configuration
@EnableSwagger2
public class SwaggerConfig {

@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com"))
.paths(PathSelectors.any()).build();
}
private ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title("Wh")
.description("test")
.version("1.2")
.build();
}
}

@Api(tags = "用户管理") // tags:你可以当作是这个组的名字。
@ApiOperation(value = "用户测试",notes = "用户测试notes") 描述接口

标签:notes,swagger2.0,2.9,apiInfo,io,springfox
From: https://www.cnblogs.com/xyangs/p/17382408.html

相关文章