Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/belier-cn/swagger-customer-api

添加swagger额外的接口文档
https://github.com/belier-cn/swagger-customer-api

spring spring-mvc swagger

Last synced: 7 days ago
JSON representation

添加swagger额外的接口文档

Awesome Lists containing this project

README

        

### 添加swagger额外的接口文档
[![Maven Central](https://img.shields.io/maven-central/v/cn.belier/swagger-customer-api.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22cn.belier%22%20AND%20a:%22swagger-customer-api%22)

### 如何使用

#### 引入依赖
```xml

cn.belier
swagger-customer-api
最新版本,参见上面的图标

```

#### 编写接口文档

用 CustomerApi 标记,不使用 RestController

```java

@Api(tags = "测试接口")
@CustomerApi
@RequestMapping("test")
public class TestApi {

@ApiOperation("测试")
@GetMapping("test")
public String test(@RequestParam @ApiParam("测试参数") String test) {
return test;
}

}

```

#### 开启扫描注解

可以指定包名,不指定默认为标记的类的包

```java
@SwaggerCustomerApiScanner
@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

}

```

TestApi 的接口不会在 Spring MVC 中生效,但是会在文档中显示