spring-ai-starter-mcp-server-webmvc的包冲突

作者:山塘小鱼儿日期:2026/6/27

搭建spring-ai的mcp服务,引用官网的包

1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="http://maven.apache.org/POM/4.0.0"
3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5    <modelVersion>4.0.0</modelVersion>
6
7    <groupId>org.my.mcp.tools</groupId>
8    <artifactId>mcp_tools</artifactId>
9    <version>1.0-SNAPSHOT</version>
10
11    <properties>
12        <java.version>21</java.version>
13        <spring-boot.version>3.2.5</spring-boot.version>
14        <maven.compiler.source>21</maven.compiler.source>
15        <maven.compiler.target>21</maven.compiler.target>
16    </properties>
17    <dependencies>
18
19        <dependency>
20            <groupId>org.springframework.ai</groupId>
21            <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
22            <version>2.0.0</version>
23        </dependency>
24
25    </dependencies>
26
27</project>

启动类:

1package org.my.mcp.tools;
2
3import org.my.mcp.tools.service.WeatherService;
4import org.slf4j.Logger;
5import org.slf4j.LoggerFactory;
6import org.springframework.ai.tool.ToolCallbackProvider;
7import org.springframework.ai.tool.method.MethodToolCallbackProvider;
8import org.springframework.boot.SpringApplication;
9import org.springframework.boot.autoconfigure.SpringBootApplication;
10import org.springframework.context.annotation.Bean;
11
12
13@SpringBootApplication
14public class ServerStart {
15    private static final Logger logger = LoggerFactory.getLogger(ServerStart.class);
16
17    public static void main(String[] args) {
18        SpringApplication.run(ServerStart.class, args);
19    }
20
21    @Bean
22    public ToolCallbackProvider weatherTools(WeatherService weatherService) {
23        return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
24    }
25}
26

启动后报错:jackson冲突

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonSerializeAs [in thread "background-preinit"]

经过Dependency Analyzer分析后,需要约束一下版本,解决包冲突:

1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="http://maven.apache.org/POM/4.0.0"
3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5    <modelVersion>4.0.0</modelVersion>
6
7    <groupId>org.my.mcp.tools</groupId>
8    <artifactId>mcp_tools</artifactId>
9    <version>1.0-SNAPSHOT</version>
10
11    <properties>
12        <java.version>21</java.version>
13        <spring-boot.version>3.2.5</spring-boot.version>
14        <maven.compiler.source>21</maven.compiler.source>
15        <maven.compiler.target>21</maven.compiler.target>
16    </properties>
17    <dependencyManagement>
18        <dependencies>
19            <dependency>
20                <artifactId>jackson-databind</artifactId>
21                <groupId>tools.jackson.core</groupId>
22                <version>3.1.4</version>
23            </dependency>
24            <dependency>
25                <artifactId>slf4j-api</artifactId>
26                <groupId>org.slf4j</groupId>
27                <version>2.0.17</version>
28            </dependency>
29            <dependency>
30                <artifactId>jackson-annotations</artifactId>
31                <groupId>com.fasterxml.jackson.core</groupId>
32                <version>2.21</version>
33            </dependency>
34            <dependency>
35                <artifactId>jackson-core</artifactId>
36                <groupId>tools.jackson.core</groupId>
37                <version>3.1.4</version>
38            </dependency>
39        </dependencies>
40    </dependencyManagement>
41    <dependencies>
42        <dependency>
43            <groupId>org.springframework.ai</groupId>
44            <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
45            <version>2.0.0</version>
46        </dependency>
47    </dependencies>
48
49</project>

启动成功:

1Connected to the target VM, address: '127.0.0.1:50454', transport: 'socket'
2
3  .   ____          _            __ _ _
4 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
5( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
6 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
7  '  |____| .__|_| |_|_| |_\__, | / / / /
8 =========|_|==============|___/=/_/_/_/
9
10 :: Spring Boot ::                (v4.1.0)
11
12[serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
132026-06-24T09:30:10.116+08:00  WARN 4520 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'serverAnnotatedBeanRegistry' of type [org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration$ServerMcpAnnotatedBeans] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
142026-06-24T09:30:10.126+08:00  WARN 4520 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.ai.mcp.server.annotation-scanner-org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerProperties' of type [org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [serverAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
152026-06-24T09:30:10.424+08:00  INFO 4520 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat initialized with port 8080 (http)
162026-06-24T09:30:10.440+08:00  INFO 4520 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
172026-06-24T09:30:10.440+08:00  INFO 4520 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/11.0.22]
182026-06-24T09:30:10.499+08:00  INFO 4520 --- [           main] b.w.c.s.WebApplicationContextInitializer : Root WebApplicationContext: initialization completed in 1058 ms
192026-06-24T09:30:11.124+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable tools capabilities, notification: true
202026-06-24T09:30:11.212+08:00  WARN 4520 --- [           main] o.s.a.m.a.p.tool.SyncMcpToolProvider     : No tool methods found in the provided tool objects: []
212026-06-24T09:30:11.213+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Registered tools: 1
222026-06-24T09:30:11.213+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable resources capabilities, notification: true
232026-06-24T09:30:11.217+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable resources templates capabilities, notification: true
242026-06-24T09:30:11.219+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable prompts capabilities, notification: true
252026-06-24T09:30:11.222+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable completions capabilities
262026-06-24T09:30:11.405+08:00  INFO 4520 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat started on port 8080 (http) with context path '/'
272026-06-24T09:30:11.410+08:00  INFO 4520 --- [           main] org.my.mcp.tools.ServerStart             : Started ServerStart in 2.578 seconds (process running for 3.187)

spring-ai-starter-mcp-server-webmvc的包冲突》 是转载文章,点击查看原文


相关推荐


斥资500元/上亿Token,深度横评4个顶尖模型的真实排名~
AI袋鼠帝2026/6/18

大家好,我是袋鼠帝。 6月,感觉又是模型爆发的月份。 前有MiniMax-M3,然后是Claude Fable 5,到Kimi 2.7-code、GLM-5.2,麻了。 我现在都不想看模型的各种榜单、跑分了,感觉有很多刷榜的嫌疑。 而且,每次我测新模型,都有很多朋友在评论区比较其他模型。 毛选说的好,没有调查就没有发言权,实践是检验真理的唯一标准! 这次就来给大家做个顶级模型横测吧 看了下,kimi最新模型主要是编程能力强,这次我想测多个维度。GLM-5.2的Coding Plan暂时没抢到。。


警惕供应链陷阱:从 Red Hat npm 恶意包事件看依赖安全防护
在水一缸2026/6/10

警惕供应链陷阱:从 Red Hat npm 恶意包事件看依赖安全防护 在现代软件开发的宏大叙事中,开源供应链安全已经成为最惊心动魄的章节之一。近期,安全社区爆出的一起针对 Red Hat Cloud Services 的恶意 npm 包事件,再次为我们敲响了警钟。这不仅仅是一次简单的安全通报,它揭示了当前软件供应链攻击手段的隐蔽性与危害性正在不断升级。 对于中级开发者而言,理解这类攻击的底层逻辑、掌握识别恶意包的技巧以及建立系统性的防御思维,已成为职场进阶的必修课。本文将深入剖析这一事件的攻击原


【最新Codex教程】 | 安装、入门和快速使用,适合新手
呆呆敲代码的小Y2026/6/3

前言 🕹️【最新Codex教程】 | 安装、入门和快速使用,适合新手🧐一、 Codex 简介🚀二、安装方法2.1 安装Codex CLI2.2 安装Codex桌面端(推荐) 🎈三、Codex CLI🧑‍💻四、Codex 桌面端4.1 设置页面(语言、宠物、个性化等)4.2 布局区域4.3 工作区管理4.4 添加插件和技能(重要)4.5 配置模型,计划模式和追求目标4.6 权限管理 ✈️五、 账户与订阅💕六、使用技巧6.1 Codex中一直Reconnectin


Agent系列(七):知识库集成——Agent 调用 RAG 的正确姿势
冬奇Lab2026/5/28

RAG 遇上 Agent,不只是"给 LLM 接个搜索框" 很多人第一次接触 RAG,都是这个用法:用户问一个问题 → 检索知识库 → 把结果塞进 Prompt → LLM 生成回答。 这个模式叫 Pipeline RAG。它有效,但有个根本问题——它不思考。 Pipeline RAG 对每一个问题都执行检索,不管这个问题是问"WonderBot 订阅多少钱"(确实需要查知识库),还是问"Python 列表怎么求平均值"(LLM 自己就知道)。它像一个只会一招的工人:不管手头的活是什么,都先去仓


计算机毕业设计:Python出行数据智能分析与预测平台 Django框架 可视化 数据分析 PyEcharts 交通 深度学习(建议收藏)✅
源码之屋2026/5/5

博主介绍:✌全网粉丝10W+,前互联网大厂软件研发、集结硕博英豪成立工作室。专注于计算机相关专业项目实战6年之久,选择我们就是选择放心、选择安心毕业✌ > 🍅想要获取完整文章或者源码,或者代做,拉到文章底部即可与我联系了。🍅 点击查看作者主页,了解更多项目! 🍅感兴趣的可以先收藏起来,点赞、关注不迷路,大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助同学们顺利毕业 。🍅 1、毕业设计:2026年计算机专业毕业设计选题汇总(建议收藏)✅ 2、大数据毕业


OceanBase学习
摇曳的精灵2026/4/26

OceanBase(OB)是蚂蚁集团完全自研的原生分布式关系型数据库,2010年诞生,支撑支付宝/双11核心交易,金融级高可用,同时兼容 MySQL 与 Oracle 两种模式,是国产分布式数据库的标杆。 一、核心定位(一句话懂差异) Oracle:集中式商用数据库,闭源,高端硬件,强事务,金融传统核心。达梦DM8:集中式(可选共享存储集群),Oracle 高度兼容,政务/国企信创首选。OceanBase:原生分布式,MySQL/Oracle 双兼容,普通x86服务器,水平扩展,金融互联网核心


深度解析 Rollup 配置与 Vite 生产构建流程
发现一只大呆瓜2026/4/17

前言 为什么 Vite 在生产环境不使用 ESBuild 而是选择 Rollup?为什么 Rollup 打包出来的代码比 Webpack 更纯粹?本文将带你深入 Rollup 的核心配置,并拆解 Vite 是如何驱动 Rollup 完成生产环境构建的。 一、 Rollup 核心配置:构建系统的“方向盘” 1. 核心概念 Rollup 是 Vite 生产环境下的底层打包工具,专注于 ES 模块的打包优化。 注意:在 Vite 项目中,不需要单独编写rollup.config.js文件,所有 Rol


理解PDF的设计哲学,省下一半的编辑时间
databook2026/4/9

复制文字带换行?改一个字排版全乱?同一个文件到处显示一致? 我以前也觉得是PDF软件太垃圾。后来想通了:不是软件不行,是我一直把它用错了地方。 我被PDF坑过太多次了 从论文里复制一段话,贴出来全是"-"和莫名其妙的换行 想改一个错别字,后面的内容全跑了,调坐标调到想砸电脑 给客户发的报价单,在他电脑上竟然一模一样…… 最后一条其实不是坑,是惊喜。但前两条,真的烦。 后来我才搞明白一件事: PDF从一开始就不是让你编辑的。 它更像一张"数字相纸"——只管长啥样,不管你怎么改。 把它当电子纸


我用AI做了一个48秒的真人精品漫剧,不难也不贵
华洛2026/4/1

前言 最近花了点时间用AI做了一个48秒的真人精品漫剧,只能说在AI时代各行各业都被冲击的体无完肤... 制作方法 工具和平台 图片生成用到的模型是liblib、seedance2.0 视频生成用到的模型是可灵Omni、即梦图片5.0 平台用的是liblib、即梦 剪辑工具用到的是剪映 说一下这套工具的选择和搭配原因: 即梦作为当前生图、生视频第一梯队,一开始是我的首选,但是排队太久和真人验证确实令人心烦,后续逐渐演变为生图和补充的主力,不用来生视频了; 最终视频生成模型就选用了Omni,不过可


从 OpenClaw 到 Android:Harness Engineering 是怎么让 Agent 变得可用的
陆业聪2026/3/24

最近看到一张图,把 Agent 工程的演化路线列了出来:ReAct(2023初)→ Plan & Execute(2023末)→ Multi-Agent(2024)→ Context Engineering(2025)→ Harness Engineering(2025+)。配了一句话: "名词换了五六轮,核心问题从未改变。Agent 工程师的核心能力:在不确定性上构建确定性。" 这句话我反复想了一下,觉得说到点子上了。这篇文章不打算再讲 Harness Engineering 的定义,而是

首页编辑器站点地图

本站内容在 CC BY-SA 4.0 协议下发布

Copyright © 2026 聚合阅读