spring-projects / spring-projects/spring-ai

Remove `@Deprecated(forRemoval=true)` APIs accumulated during 2.0.0 development

Open
#6,347 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Overview

During the 2.0.0-M32.0.0 development cycle a number of APIs were marked @Deprecated(forRemoval = true) with clear replacements already in place. None of these have a dedicated removal issue filed against them. This is a tracking issue to remove them — ideally in 2.1.x or whichever release follows 2.0.0 GA.

No business logic changes are needed; every item below has a direct replacement already in the codebase.


Items to remove

1. JsonParser (entire class)
  • File: spring-ai-model/src/main/java/org/springframework/ai/util/json/JsonParser.java
  • Introduced by: PR #6135 — "Refactor JSON utilities"
  • Replace with: JsonHelper / JacksonUtils

2. TokenTextSplitter — 5 deprecated constructors
  • File: spring-ai-commons/src/main/java/org/springframework/ai/transformer/splitter/TokenTextSplitter.java
  • Deprecated since: 2.0.0-M3
  • Replace with: TokenTextSplitter.builder() fluent API
// Before (deprecated)
new TokenTextSplitter()
new TokenTextSplitter(boolean keepSeparator)
new TokenTextSplitter(EncodingType encodingType)
new TokenTextSplitter(EncodingType, boolean)
new TokenTextSplitter(int, int, int, int, boolean)

// After
TokenTextSplitter.builder().withChunkSize(500).build()

3. MCP SSE transports — 3 entire classes deprecated since 2.0.0

Deprecated by commit "Deprecate SSE transports, set Streamable HTTP as default server protocol" (May 2026). Streamable HTTP is now the default.

Deprecated class Replacement
WebFluxSseServerTransportProvider WebFluxStreamableServerTransportProvider
WebMvcSseServerTransportProvider WebMvcStreamableServerTransportProvider
WebFluxSseClientTransport WebFluxStreamableClientTransportProvider

4. SyncMcpToolCallbackProvider / AsyncMcpToolCallbackProvider — 4 constructors each
  • Files: mcp/common/src/main/java/org/springframework/ai/mcp/Sync|AsyncMcpToolCallbackProvider.java
  • Replace with: .builder() — Javadoc on each deprecated constructor says "use #builder() instead"

5. SyncMcpToolCallback / AsyncMcpToolCallback — deprecated methods
  • Files: mcp/common/src/main/java/org/springframework/ai/mcp/Sync|AsyncMcpToolCallback.java
  • Replace with: respective builder methods

6. getDefaultOptions() across all model implementations
  • Renamed to getOptions() in the ChatModel interface.
  • All model impls (OpenAiChatModel, OllamaChatModel, AnthropicChatModel, MistralAiChatModel, BedrockConverseChatModel, etc.) still carry the deprecated bridge override.
  • Replace with: getOptions()

7. SyncMcpLogginProvider (typo class — entire class @Deprecated)
  • File: mcp/mcp-annotations/.../provider/logging/SyncMcpLogginProvider.java
  • This is the typo'd variant (Loggin instead of Logging). The correct class SyncMcpLoggingProvider already exists alongside it.
  • Safe to delete — no external references.

8. Various model-specific deprecated methods
File Method Replacement
OpenAiChatModel.java:170 getDefaultOptions() getOptions()
OpenAiAudioSpeechModel.java:186 deprecated method current equivalent
ElevenLabsTextToSpeechModel.java:193 deprecated method current equivalent
TextToSpeechModel.java:55 deprecated method current equivalent
DeepSeekAssistantMessage.java:46,51 deprecated since 2.0.0 current constructors
AnthropicChatModel.java:1634 inner builder deprecated since 2.0.0 .builder()

What is NOT in scope here

  • MistralAiApi model field with comment "Retirement planned 31st July 2026" — that has an external dependency on Mistral's retirement schedule.
  • Any @Deprecated without forRemoval = true — those are lower priority.

Suggested milestone

2.1.x — after 2.0.0 GA establishes the stable baseline and gives the ecosystem time to migrate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the listed deprecated files and model implementations, including JsonParser.java, TokenTextSplitter.java, the MCP callback and transport classes, and the model classes named in the issue. Check references before removing each API and use the stated builders or replacement classes. Done means all listed @Deprecated(forRemoval = true) APIs are removed without touching lower-priority deprecations or MistralAiApi.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
ai, backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.