|
21 | 21 | import java.util.function.BiConsumer; |
22 | 22 | import java.util.function.BiFunction; |
23 | 23 |
|
24 | | -import com.fasterxml.jackson.annotation.JsonInclude; |
25 | | -import com.fasterxml.jackson.databind.DeserializationFeature; |
26 | 24 | import com.fasterxml.jackson.databind.ObjectMapper; |
27 | | -import com.fasterxml.jackson.databind.SerializationFeature; |
28 | | -import com.fasterxml.jackson.databind.json.JsonMapper; |
29 | 25 | import io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapper; |
30 | 26 | import io.modelcontextprotocol.server.McpAsyncServer; |
31 | 27 | import io.modelcontextprotocol.server.McpAsyncServerExchange; |
|
54 | 50 |
|
55 | 51 | import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerChangeNotificationProperties; |
56 | 52 | import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties; |
57 | | -import org.springframework.ai.util.JacksonUtils; |
58 | 53 | import org.springframework.beans.factory.ObjectProvider; |
59 | 54 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
60 | 55 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
@@ -114,18 +109,7 @@ public class McpServerAutoConfiguration { |
114 | 109 | @Bean(name = "mcpServerObjectMapper") |
115 | 110 | @ConditionalOnMissingBean(name = "mcpServerObjectMapper") |
116 | 111 | public ObjectMapper mcpServerObjectMapper() { |
117 | | - return JsonMapper.builder() |
118 | | - // Deserialization configuration |
119 | | - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) |
120 | | - .enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) |
121 | | - // Serialization configuration |
122 | | - .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) |
123 | | - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) |
124 | | - .serializationInclusion(JsonInclude.Include.NON_NULL) |
125 | | - // Register standard modules (Jdk8, JavaTime, ParameterNames, Kotlin if |
126 | | - // available) |
127 | | - .addModules(JacksonUtils.instantiateAvailableModules()) |
128 | | - .build(); |
| 112 | + return McpServerObjectMapperFactory.createObjectMapper(); |
129 | 113 | } |
130 | 114 |
|
131 | 115 | @Bean |
|
0 commit comments