Skip to content

README增加jackson兼容性解决方法 #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

lianup
Copy link
Contributor

@lianup lianup commented Mar 25, 2022

No description provided.

@lianup lianup changed the title EADME增加jackson兼容性解决方法 README增加jackson兼容性解决方法 Mar 25, 2022
README.md Outdated
@@ -359,6 +359,29 @@ dependencies {
}
```

### 如何解决jackson兼容性问题
项目使用的jackson版本为`2.12.5`,同时引入该项目和版本低于`2.5.x`的SpringBoot会有jackson兼容性问题。推荐升级SpringBoot到版本`2.5.x`及以上。如无法升级,可按照下述方式指定jackson版本。
Copy link
Contributor

@xy-peng xy-peng Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 具体原因应该讲得更清楚。首先是我们升级了jackson并使用了2.11中的API。但是,其他组件依赖了低版本,自动引入产生了冲突。
  2. 建议升级Springboot版本时,建议补充原因,别人才愿意升级嘛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

README.md Outdated
@@ -359,6 +359,29 @@ dependencies {
}
```

### 如何解决jackson兼容性问题
项目使用的jackson版本为`2.12.5`,同时引入该项目和版本低于`2.5.x`的SpringBoot会有jackson兼容性问题。推荐升级SpringBoot到版本`2.5.x`及以上。如无法升级,可按照下述方式指定jackson版本。
#### gradle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

留意大小写

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle 的 G 也要大写,包括下面的 Maven

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

README.md Outdated
@@ -359,6 +359,28 @@ dependencies {
}
```

### 如何解决jackson兼容性问题
项目升级了Jackson依赖,在代码中使用了版本高于`2.11`的API。当其他组件引用低版本的Jackson时会导致依赖冲突,例如版本低于`2.3.x`的SpringBoot。[官方已不再维护版本低于`2.3.x`的SpringBoot](https://spring.io/projects/spring-boot#support),推荐升级。如无法升级,可按照下述方式指定Jackson版本。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用 < <= > >=来精确表达区间开闭,在点进去「官方已不再维护版本低于2.3.x的SpringBoot」这个链接之前,我是不太确定「低于2.3.x」是否包含2.3.x的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

```
#### maven
```xml
<dependencyManagement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

依赖填写的顺序是否需要说明下?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是单独的dependencyManagement依赖管理块,这个块里只需声明一个依赖,所以不用说明顺序。依赖管理块与单独的dependencies是不相关的。

README.md Outdated
@@ -359,6 +359,28 @@ dependencies {
}
```

### 如何解决jackson兼容性问题
项目升级了Jackson依赖,在代码中使用了版本>=`2.11`的API。当其他组件引用低版本的Jackson时会导致依赖冲突,例如版本<`2.3.x`的SpringBoot。[官方已不再维护版本<`2.3.x`的SpringBoot](https://spring.io/projects/spring-boot#support),推荐升级。如无法升级,可按照下述方式指定Jackson版本。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段话感觉很生硬,应该使用对话式的语态,就像跟开发者说话那样。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在之前的版本中,我们出于安全考虑升级 Jackson 到 2.12,并使用了 2.11 版本中新增的方法 xxx。如果你的项目所依赖的其他组件又依赖了低于 2.11 版本的 Jackson,可能会出现依赖冲突。

我们建议有能力的开发者,升级冲突组件至较新的兼容版本。例如,issue #125 版本 <2.3.x 的 SpringBoot 官方已不再维护,继续使用可能会有安全隐患。

如果难以升级,你可以使用 dependencyManagement 指定 Jackson 版本。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为项目升级了Jackson依赖,在代码中使用了版本>=2.11的API,当其他组件引用低版本的Jackson时会导致依赖冲突。例如版本<2.3.x的SpringBoot。由于官方已不再维护版本<2.3.x的SpringBoot,继续使用有风险,推荐开发者及时升级。如果由于特殊原因无法升级,可以按照下面的方式指定Jackson版本。

这样是否可以?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在之前的版本中,我们出于安全考虑升级 Jackson 到 2.12,并使用了 2.11 版本中新增的方法 xxx。如果你的项目所依赖的其他组件又依赖了低于 2.11 版本的 Jackson,可能会出现依赖冲突。

我们建议有能力的开发者,升级冲突组件至较新的兼容版本。例如,issue #125 版本 <2.3.x 的 SpringBoot 官方已不再维护,继续使用可能会有安全隐患。

如果难以升级,你可以使用 dependencyManagement 指定 Jackson 版本。

get,我根据这个来修改一下。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在之前的版本中,我们出于安全考虑升级 Jackson 到 2.12,并使用了 2.11 版本中新增的方法 xxx。如果你的项目所依赖的其他组件又依赖了低于 2.11 版本的 Jackson,可能会出现依赖冲突。

我们建议有能力的开发者,升级冲突组件至较新的兼容版本。例如,issue #125 版本 <2.3.x 的 SpringBoot 官方已不再维护,继续使用可能会有安全隐患。

如果难以升级,你可以使用 dependencyManagement 指定 Jackson 版本。

这里是否加上Gradle和Maven的指定方式比较好?因为Gradle也会有这样的问题

@lianup lianup merged commit 8849a35 into wechatpay-apiv3:master Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jackson2.12.5 与 springboot 2.2.6.RELEASE 兼容性问题
4 participants