From 0c968731737b9cf077f7954f70bcbb24f0a24263 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Sat, 10 May 2025 08:26:30 +0200 Subject: [PATCH] Clean code deprecations Signed-off-by: Christian Tzolov --- .../ai/openai/samples/helloworld/Application.java | 5 ++--- model-context-protocol/mcp-annotations-server/README.md | 2 +- .../sampling/mcp-weather-webmvc-server/README.md | 2 +- .../springframework/ai/mcp/sample/server/WeatherService.java | 1 - .../org/springframework/ai/mcp/sample/client/ClientSse.java | 2 +- .../weather/starter-webmvc-server/README.md | 2 +- .../org/springframework/ai/mcp/sample/client/ClientSse.java | 2 +- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/agents/reflection/src/main/java/org/springframework/ai/openai/samples/helloworld/Application.java b/agents/reflection/src/main/java/org/springframework/ai/openai/samples/helloworld/Application.java index df63a86..3acd814 100644 --- a/agents/reflection/src/main/java/org/springframework/ai/openai/samples/helloworld/Application.java +++ b/agents/reflection/src/main/java/org/springframework/ai/openai/samples/helloworld/Application.java @@ -1,13 +1,12 @@ package org.springframework.ai.openai.samples.helloworld; -import org.springframework.ai.chat.client.ChatClient; +import java.util.Scanner; + import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; -import java.util.Scanner; - @SpringBootApplication public class Application { diff --git a/model-context-protocol/mcp-annotations-server/README.md b/model-context-protocol/mcp-annotations-server/README.md index 11af7b8..eb55985 100644 --- a/model-context-protocol/mcp-annotations-server/README.md +++ b/model-context-protocol/mcp-annotations-server/README.md @@ -140,7 +140,7 @@ You can connect to the weather server using either STDIO or SSE transport: For servers using SSE transport: ```java -var transport = new HttpClientSseClientTransport("http://localhost:8080"); +var transport = HttpClientSseClientTransport.builder("http://localhost:8080").build(); var client = McpClient.sync(transport).build(); ``` diff --git a/model-context-protocol/sampling/mcp-weather-webmvc-server/README.md b/model-context-protocol/sampling/mcp-weather-webmvc-server/README.md index 3409df2..fcdb3c8 100644 --- a/model-context-protocol/sampling/mcp-weather-webmvc-server/README.md +++ b/model-context-protocol/sampling/mcp-weather-webmvc-server/README.md @@ -166,7 +166,7 @@ You can connect to the weather server using either STDIO or SSE transport: For servers using SSE transport: ```java -var transport = new HttpClientSseClientTransport("http://localhost:8080"); +var transport = HttpClientSseClientTransport.builder("http://localhost:8080").build(); var client = McpClient.sync(transport).build(); ``` diff --git a/model-context-protocol/sampling/mcp-weather-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/server/WeatherService.java b/model-context-protocol/sampling/mcp-weather-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/server/WeatherService.java index 1c0494d..e793d54 100644 --- a/model-context-protocol/sampling/mcp-weather-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/server/WeatherService.java +++ b/model-context-protocol/sampling/mcp-weather-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/server/WeatherService.java @@ -18,7 +18,6 @@ package org.springframework.ai.mcp.sample.server; import java.time.LocalDateTime; import java.util.List; -import io.modelcontextprotocol.server.McpSyncServerExchange; import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema.CreateMessageResult; import io.modelcontextprotocol.spec.McpSchema.LoggingLevel; diff --git a/model-context-protocol/sampling/mcp-weather-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java b/model-context-protocol/sampling/mcp-weather-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java index 3846cc5..f8ab30a 100644 --- a/model-context-protocol/sampling/mcp-weather-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java +++ b/model-context-protocol/sampling/mcp-weather-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java @@ -24,7 +24,7 @@ import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; public class ClientSse { public static void main(String[] args) { - var transport = new HttpClientSseClientTransport("http://localhost:8080"); + var transport = HttpClientSseClientTransport.builder("http://localhost:8080").build(); new SampleClient(transport).run(); } diff --git a/model-context-protocol/weather/starter-webmvc-server/README.md b/model-context-protocol/weather/starter-webmvc-server/README.md index 490fe40..36121e1 100644 --- a/model-context-protocol/weather/starter-webmvc-server/README.md +++ b/model-context-protocol/weather/starter-webmvc-server/README.md @@ -140,7 +140,7 @@ You can connect to the weather server using either STDIO or SSE transport: For servers using SSE transport: ```java -var transport = new HttpClientSseClientTransport("http://localhost:8080"); +var transport = HttpClientSseClientTransport.builder("http://localhost:8080").build(); var client = McpClient.sync(transport).build(); ``` diff --git a/model-context-protocol/weather/starter-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java b/model-context-protocol/weather/starter-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java index 3846cc5..f8ab30a 100644 --- a/model-context-protocol/weather/starter-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java +++ b/model-context-protocol/weather/starter-webmvc-server/src/test/java/org/springframework/ai/mcp/sample/client/ClientSse.java @@ -24,7 +24,7 @@ import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; public class ClientSse { public static void main(String[] args) { - var transport = new HttpClientSseClientTransport("http://localhost:8080"); + var transport = HttpClientSseClientTransport.builder("http://localhost:8080").build(); new SampleClient(transport).run(); }