Skip to content

GH-6602: Align OkHttp dependency on okhttp-jvm 5.3.2 - #6735

Open
Yobil-Job wants to merge 1 commit into
spring-projects:mainfrom
Yobil-Job:6602-align-okhttp-5
Open

GH-6602: Align OkHttp dependency on okhttp-jvm 5.3.2#6735
Yobil-Job wants to merge 1 commit into
spring-projects:mainfrom
Yobil-Job:6602-align-okhttp-5

Conversation

@Yobil-Job

@Yobil-Job Yobil-Job commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #6602

Problem

Spring AI currently depends on com.squareup.okhttp3:okhttp:4.12.0.

With Spring Boot 4's OpenTelemetry starter, applications can receive com.squareup.okhttp3:okhttp-jvm:5.3.2. Since Maven treats okhttp and okhttp-jvm as different artifacts, both JARs can exist on the classpath and introduce duplicate okhttp3.* classes.

Additionally, using okhttp:5.x directly would not solve this because the OkHttp 5 root artifact is only a Kotlin Multiplatform metadata artifact; the JVM implementation is published as okhttp-jvm.

Solution

Aligned Spring AI's OkHttp dependency usage with the OkHttp 5 JVM artifact:

  • Updated okhttp3.version from 4.12.0 to 5.3.2
  • Migrated spring-ai-openai from okhttp to okhttp-jvm
  • Migrated spring-ai-anthropic from okhttp to okhttp-jvm
  • Updated Typesense dependency management to use okhttp-jvm
  • Excluded the transitive okhttp:4.x dependency from typesense-java to prevent duplicate classes

Verification

Confirmed Maven dependency resolution contains only:

com.squareup.okhttp3:okhttp-jvm:5.3.2

Verified affected modules:

  • spring-ai-openai
  • spring-ai-anthropic
  • spring-ai-typesense-store
  • spring-ai-test

All tests passed.

No Java source changes were required.

Signed-off-by: Eyob Weldetensay <eyobwldetensay@gmail.com>
@Yobil-Job
Yobil-Job force-pushed the 6602-align-okhttp-5 branch from a1a5285 to 239b40c Compare August 4, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align spring-ai-openai on OkHttp 5.x (okhttp-jvm) to avoid silent duplicate classes with Spring Boot 4's OpenTelemetry starter (Maven)

2 participants