当前位置:网站首页>Forest v1.5.22 发布!支持Kotlin
Forest v1.5.22 发布!支持Kotlin
2022-06-11 01:50:00 【Dromara开源组织】
Forest介绍
Forest 是一个开源的 Java HTTP 客户端框架,它能够将 HTTP 的所有请求信息(包括 URL、Header 以及 Body 等信息)绑定到您自定义的 Interface 方法上,能够通过调用本地接口方法的方式发送 HTTP 请求
Forest 如何使用
Forest 不需要您编写具体的 HTTP 调用过程,只需要您定义一个接口,然后通过 Forest 注解将 HTTP 请求的信息添加到接口的方法上即可。请求发送方通过调用您定义的接口便能自动发送请求和接受请求的响应
Forest 的工作原理
Forest 会将您定义好的接口通过动态代理的方式生成一个具体的实现类,然后组织、验证 HTTP 请求信息,绑定动态数据,转换数据形式,SSL 验证签名,调用后端 HTTP API(httpclient 等 API)执行实际请求,等待响应,失败重试,转换响应数据到 Java 类型等脏活累活都由这动态代理的实现类给包了。 请求发送方调用这个接口时,实际上就是在调用这个干脏活累活的实现类
获得奖项
2021 年度 OSC 中国开源项目评选「最受欢迎项目」
相关链接: https://www.oschina.net/project/top_cn_2021
重点更新内容
统一连接池
不用再分别定义 OkHttp 和 Httpclient 的连接池了,也不用担心异步请求和同步请求不在同一个连接池的烦恼了
本次更新统一连接池,可以通过 max-connections 和 max-route-connections 属性统一管理 OkHttp 和 HttpClient 所有后端的所有请求的最大请求数和最大每路由请求数,同时也包括异步请求在内可以一同进行限制
参数定义返回类型
当接口方法返回的是未知参数的泛型类型时,可以通过新增的@Return参数注解,来标识某个参数为返回类型
// 通过 Class 类型参数来标识返回类型 @Get("/user/info") <T> T getGenericClass(@Return Class<T> clazz); // 通过 Type 类型参数来标识返回类型 @Get("/user/info") <T> T getGenericType(@Return Type type); // 通过 TypeReference 类型参数来标识返回类型 @Get("/user/info") <T> T getGenericTypeReference(@Return TypeReference<T> typeReference);官网和仓库地址
官网地址:
Gitee 仓库地址:
https://gitee.com/dromara/forest
Github 仓库地址:
本次更新内容
新增特性
- feat: 统一连接池 (#I5APJA)
- feat: 可配置异步请求线程池队列大小 (#I5B78X)
- feat: 支持通过参数定义返回类型 (#I5ANZL)
修复问题
- fix: spring 5.1 以下的低版本启动失败
- fix: 请求地址中包含#字符会被转义导致资源找不到 (#I59O7M)
- fix: 配置BaseRequest的baseURL属性后,完整请求路径中的默认端口号会被覆盖,导致请求失败 (#I4YBDV)
- fix: 解决当@body注解在对象上标识以后,char&Character类型的属性无法从客户端传输至服务端问题
- fix: kotlin项目启动异常 (#I50PDZ)
- fix: RetryWhen重试条件接口在最后一次重试后会执行两次 (#I599BT)
其它改动
- update: #I5ANZR 删除单元测试代码中的Log4j2依赖
特别鸣谢
本次更新参与贡献的小伙伴
- @xiao4852
此文章版权归属dromara开源组织所有(https://dromara.org/)
边栏推荐
- Core principle and code explanation of epoll reactor model
- About stepping on the pit diary and the association of knowledge points
- Ortele has obtained three rounds of financing nine months after its establishment, and hard discount stores have found new ways to grow?
- 378. 有序矩阵中第 K 小的元素
- Why can some programmers get good offers with average ability?
- How to guarantee the data quality of data warehouse?
- The diligent is the laziest
- A collection of common ADB commands for app testing
- Tests logiciels vocabulaire commun anglais
- Kotlin let方法
猜你喜欢

What is the relationship between precious metal silver and spot Silver

Sd3.0 notes

查看Redis内数据,除了命令行和客户端,你还有第三种选择

A collection of common ADB commands for app testing
![[parallel and distributed systems] cache learning](/img/79/de4da45aab54bb3bec240ac36e7978.png)
[parallel and distributed systems] cache learning

学习太极创客 — ESP8226 (二)

Binary tree sequence traversal

【AI周报】AI与冷冻电镜揭示「原子级」NPC结构;清华、商汤提出「SIM」方法兼顾语义对齐与空间分辨能力

【冒泡排序的实现】

10 years of domestic milk powder counter attack: post-90s nannies and dads help new domestic products counter attack foreign brands
随机推荐
STC8A8K64D4 EEPROM读写失败
What can the enterprise exhibition hall design bring to the enterprise?
The most complete format description of clang format
金属有机框架MOF-Al(DIBA),MOF-Zr(DIBA),MOF-Fe(DIBA)包载姜黄素/羧苄西林/MTX甲氨蝶呤/紫杉醇PTX/阿霉素DOX/顺铂CDDP/CPT喜树碱等药物
Why can some programmers get good offers with average ability?
SQL | 返回顾客名称和相关订单号以及每个订单的总价
1031. maximum sum of two non overlapping subarrays
SD3.0笔记
clang-format 最全格式说明
Databinding escaping with presentation symbols
Penetration test - security service system +owasp top 10
Epoll 原理及应用 && ET模式与LT模式
A digit DP
环糊精金属有机骨架(β-CD-MOF)装载二巯丁二酸/大黄素/槲皮素/三氯蔗糖/二氟尼柳/奥美拉唑(OME)
Li Kou brushing questions - hash table
Large screen - full screen, exit full screen
Binary tree sequence traversal
Ortele has obtained three rounds of financing nine months after its establishment, and hard discount stores have found new ways to grow?
渗透测试-安全服务体系+OWASP top 10
Write my Ini configuration file error