# fn-open-util
**Repository Path**: topfn/fn-open-util
## Basic Information
- **Project Name**: fn-open-util
- **Description**: 一个轻量级企业接口封装SDK,以简单的方式提供接口给外部调用
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: https://fntop.gitee.io/fn-open-util
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2023-08-21
- **Last Updated**: 2023-08-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README

#### 介绍
开放接口封装 的 `spring boot starter`,这个`starter`是为了方便将开放接口进行封装并提供给外部调用。
以注解方式进行快速封装,并且支持丰富的自定义扩展。 点击查看[使用案例](https://gitee.com/FnTop/fn-sms)
##### 兼容性
| version | spring boot version | java version |
|:-------:|:-------------------:|:------------:|
| 2.0.2 | 2.6.2 | 1.8 |
##### maven
```
cn.fntop
open-api-spring-boot-starter
2.0.2
```
##### gradle
```
//方式1
implementation 'cn.fntop:open-api-spring-boot-starter:2.0.2'
//方式2
implementation group: 'cn.fntop', name: 'open-api-spring-boot-starter', version: '2.0.2'
```
#### 友善提示

### 配置
```
fn:
#接口网关,域名+your-context,如果没有context就不用加context,尾部一定要加上`/`
open-gateway: http://xxx.com/your-context/
#代理
proxy-domain: xxx
proxy-port: xxx
```
#### 配置说明
| 配置项 | 默认值 | 说明 |
|:-----------------------------|:-----------------------------|:------------------------------------------|
| fn.open-gateway | http://xxx.com/your-context/ | 接口调用网关,默认http://127.0.0.1:8080/。末尾一定要加"/" |
| fn.proxy-domain | 127.0.0.1 | 代理主机 |
| fn.proxy-port | 38672 | 代理端口 |
### 默认调用
添加依赖项后自动注入`OpenApiService`即可
```java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class Demo {
private final OpenApiService openApiService;
}
//或者
@Service
public class Demo {
@Autowired
private OpenApiService openApiService;
public Object method1(){
//参数为接口地址
openApiService.get("hello/custom");
}
}
//OpenApiService 默认封装的接口,如需扩展继续往下阅读
public interface OpenApi {
//更多注解的使用方式请参考注解附录大纲
@HTTP(method = "GET")
Single