dromara / dromara/forest

[重要] 新版本依赖会导致 NoSuchMethod 异常

Open
#222 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

现象:
![Image](https://github.com/user-attachments/assets/f4ac3c78-c389-4ee1-b518-f67c02c8b22e)

导致结果:
只要有二方或者三方包引用了 1.5的版本,且使用了 get 或者post 方法。
其他项目在使用这个二方或者三方包的时候,必须确保也是1.5版本,如果当前项目是1.6版本 直接会报错。
get 作为一个提别基础的方法,兼容性要做好。

原因:

版本1

![Image](https://github.com/user-attachments/assets/f2ba4756-fc7b-4f5a-b0c7-60a0c807a742)

版本2

![Image](https://github.com/user-attachments/assets/aa1f6a1c-ac8f-4bad-866b-80055c6290cb)

以上2个方法都可以使用 一个参数调用,所以没啥问题。

![Image](https://github.com/user-attachments/assets/d5267e97-e416-46d8-b50b-550b78f88ebe)

但是有个场景提别要注意: 假设Forest.get(url) 这个代码写在一个二方包,然后二方包打包的时候用的版本1 ,然后项目中引入的是版本2 , 这个使用你调用二方包的方法,二方包再去调用 Forest.get(url) 会提示:NoSuchMethodError。但是你在项目里面调用 Forest.get(url) 是正常的。

简单的说: 你调用任何二方包、三方包,他再去调用其他包的任何方法都会校验签名,签名不一样就会报错,而不是方法能调通就行。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.