Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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额外的接口文档
- Host: GitHub
- URL: https://github.com/belier-cn/swagger-customer-api
- Owner: belier-cn
- License: mit
- Created: 2019-04-30T10:44:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T23:25:12.000Z (about 2 years ago)
- Last Synced: 2024-11-15T13:41:04.837Z (about 2 months ago)
- Topics: spring, spring-mvc, swagger
- Language: Java
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)### 如何使用
#### 引入依赖
```xmlcn.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 中生效,但是会在文档中显示