Git Product home page Git Product logo

Comments (7)

Speefictor avatar Speefictor commented on June 16, 2024 1

@keaixx365 不升级spring-boot的方法如下:
<dependency> <groupId>com.github.wechatpay-apiv3</groupId> <artifactId>wechatpay-java</artifactId> <version>0.2.1</version> <exclusions> <exclusion> <artifactId>okhttp</artifactId> <groupId>com.squareup.okhttp3</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>5.0.0-alpha.10</version> </dependency>

from wechatpay-java.

xy-peng avatar xy-peng commented on June 16, 2024

请参考下 #60

我猜测是你在项目中指定,或者其他组件依赖了 OkHttp 3.x。你可以手工指定 OkHttp 使用 4.x 版本。

implementation(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))

另外,如果方便的话,能告诉我是什么引入了 OkHttp 3.x吗?或者贴一下完整依赖树。

from wechatpay-java.

Speefictor avatar Speefictor commented on June 16, 2024


4.0.0

org.springframework.boot
spring-boot-starter-parent
2.6.3



<java.version>17</java.version>
true



org.springframework.boot
spring-boot-starter-data-jpa


org.springframework.boot
spring-boot-starter-data-rest

	<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<scope>runtime</scope>
	</dependency>
	<dependency>
		<groupId>com.github.wechatpay-apiv3</groupId>
		<artifactId>wechatpay-java</artifactId>
		<version>0.2.1</version>
	</dependency>
	<dependency>
		<groupId>com.alipay.sdk</groupId>
		<artifactId>alipay-sdk-java</artifactId>
		<version>4.34.68.ALL</version>
	</dependency>

	<dependency>
		<groupId>com.alibaba.fastjson2</groupId>
		<artifactId>fastjson2</artifactId>
		<version>2.0.19.android</version>
	</dependency>
	<dependency>
		<groupId>org.projectlombok</groupId>
		<artifactId>lombok</artifactId>
		<version>1.18.24</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<version>2.6.3</version>
		</plugin>
	</plugins>

</build>

from wechatpay-java.

xy-peng avatar xy-peng commented on June 16, 2024

我估计是因为你使用了 spring-boot 2.6,它依赖的是 OkHttp 3.14,所以导致 wechatpay-java-core 也用了 OkHttp 3.x。

现在有两条路:

  • 手工指定 OkHttp 使用 4.x。但是需要观察 spring-boot 对 OkHttp 4.x 的兼容性。虽然 OkHttp4 号称”除了一些小的例外(如下),OkHttp 4.x 与 OkHttp 3.x 二进制和 Java 源代码兼容“。
  • 将 spring-boot 框架升级到 2.7。在 2.7 后使用的是 OkHttp 4.x。这样可以避免 spring-boot 对 OkHttp4 的兼容问题,你需要付出框架的迁移成本。

from wechatpay-java.

Speefictor avatar Speefictor commented on June 16, 2024
com.github.wechatpay-apiv3 wechatpay-java 0.2.1 okhttp com.squareup.okhttp3 com.squareup.okhttp3 okhttp 5.0.0-alpha.10

谢谢,这个问题已解决,不过验证response又出错😅

from wechatpay-java.

keaixx365 avatar keaixx365 commented on June 16, 2024

和楼主同样的问题
Spring-Boot 2.1.6
手工指定OkHttp 4.x 会报错java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B

from wechatpay-java.

chengxu0808 avatar chengxu0808 commented on June 16, 2024

好歹是服务十几亿人的平台,多搞搞兼容性嘛

from wechatpay-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.