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

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

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.my.mcp.tools</groupId>
    <artifactId>mcp_tools</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.version>21</java.version>
        <spring-boot.version>3.2.5</spring-boot.version>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>
    <dependencies>

        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
            <version>2.0.0</version>
        </dependency>

    </dependencies>

</project>

启动类:

package org.my.mcp.tools;

import org.my.mcp.tools.service.WeatherService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;


@SpringBootApplication
public class ServerStart {
    private static final Logger logger = LoggerFactory.getLogger(ServerStart.class);

    public static void main(String[] args) {
        SpringApplication.run(ServerStart.class, args);
    }

    @Bean
    public ToolCallbackProvider weatherTools(WeatherService weatherService) {
        return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
    }
}

启动后报错:jackson冲突

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

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

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.my.mcp.tools</groupId>
    <artifactId>mcp_tools</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.version>21</java.version>
        <spring-boot.version>3.2.5</spring-boot.version>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <artifactId>jackson-databind</artifactId>
                <groupId>tools.jackson.core</groupId>
                <version>3.1.4</version>
            </dependency>
            <dependency>
                <artifactId>slf4j-api</artifactId>
                <groupId>org.slf4j</groupId>
                <version>2.0.17</version>
            </dependency>
            <dependency>
                <artifactId>jackson-annotations</artifactId>
                <groupId>com.fasterxml.jackson.core</groupId>
                <version>2.21</version>
            </dependency>
            <dependency>
                <artifactId>jackson-core</artifactId>
                <groupId>tools.jackson.core</groupId>
                <version>3.1.4</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
            <version>2.0.0</version>
        </dependency>
    </dependencies>

</project>

启动成功:

Connected to the target VM, address: '127.0.0.1:50454', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v4.1.0)

[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.
2026-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.
2026-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.
2026-06-24T09:30:10.424+08:00  INFO 4520 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat initialized with port 8080 (http)
2026-06-24T09:30:10.440+08:00  INFO 4520 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2026-06-24T09:30:10.440+08:00  INFO 4520 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/11.0.22]
2026-06-24T09:30:10.499+08:00  INFO 4520 --- [           main] b.w.c.s.WebApplicationContextInitializer : Root WebApplicationContext: initialization completed in 1058 ms
2026-06-24T09:30:11.124+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable tools capabilities, notification: true
2026-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: []
2026-06-24T09:30:11.213+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Registered tools: 1
2026-06-24T09:30:11.213+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable resources capabilities, notification: true
2026-06-24T09:30:11.217+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable resources templates capabilities, notification: true
2026-06-24T09:30:11.219+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable prompts capabilities, notification: true
2026-06-24T09:30:11.222+08:00  INFO 4520 --- [           main] o.s.a.m.s.c.a.McpServerAutoConfiguration : Enable completions capabilities
2026-06-24T09:30:11.405+08:00  INFO 4520 --- [           main] o.s.boot.tomcat.TomcatWebServer          : Tomcat started on port 8080 (http) with context path '/'
2026-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)

内容概要:本文围绕“光伏-储能-数据中心”系统的容量优化配置展开研究,旨在通过构建数学模型并结合Matlab编程现,对园区内光伏发电、储能设备数据中心算力负荷之间的多能互补关系进行协同优化。研究综合考虑可再生能源出力的波动性、储能系统的充放电特性以及数据中心的动态用电需求算力调度特性,建立以最小化综合成本、降低碳排放强度、提升能源自给率等为目标的多目标优化模型,并采用先进的智能优化算法(如粒子群、灰狼、鲸鱼等)进行求解,从而确定光伏装机容量储能系统配置的最优方案。文中提供了完整的Matlab代码现流程,涵盖数据预处理、模型构建、算法求解结果可视化全过程,属于综合能源系统信息基础设施深度融合的前沿交叉课题。; 适合人群:具备电力系统、能源工程、自动化或计算机等相关专业背景,熟悉Matlab编程基本优化算法原理,从事新能源利用、绿色数据中心、综合能源系统规划低碳调度等方向的研究生、科研人员及工程技术人员。; 使用场景及目标:① 掌握光伏-储能-数据中心耦合系统的建模思路多能流协同机制;② 学习基于Matlab的多目标容量优化配置方法智能算法应用技巧;③ 为工业园区、数字经济园区及绿色数据中心的能源系统规划、节能减排可持续运行提供科学决策依据和技术解决方案。; 阅读建议:建议结合所提供的Matlab代码,深入理解目标函数设计、约束条件设定及算法现细节,可通过调整负荷参数、改变气候数据、引入新的优化目标或约束条件等方式进行拓展性验,以深化对系统特性的认知并提升际科研工程应用能力。
内容概要:本文档聚焦于“考虑源网荷储协调的主动配电网优化调度方法”的Matlab代码复现研究,属于电力系统综合能源系统领域的高水平科研资源。文档系统阐述了融合电源侧、电网侧、负荷侧及储能系统(源-网-荷-储)协同优化的主动配电网调度模型,旨在通过先进的数学优化方法提升电力系统的经济性、可靠性低碳化水平。研究内容涵盖多时间尺度调度架构、不确定性建模(如新能源出力波动)、鲁棒优化或分布鲁棒优化(DRO)等核心技术,并依托Matlab平台完成模型构建仿真验证。同时,文档列举了多个前沿研究方向,如光储充体化、主从博弈、微电网双层优化、电氢耦合系统、电动汽车集群调度等,体现出其在现代智能电网综合能源系统优化调度中的代表性前瞻性。; 适合人群:具备电力系统基础理论知识和Matlab编程能力,从事能源、电气工程、自动化、可再生能源等方向研究的研究生、科研人员及工程技术人员,特别适合致力于优化建模、智能算法应用综合能源系统仿真的研究人员。; 使用场景及目标:① 复现高水平期刊论文中的主动配电网优化调度模型;② 掌握源网荷储协同优化的建模方法Matlab现技术;③ 借助所提供的完整代码资源开展二次开发、算法改进或新场景拓展,服务于科研创新、项目申报学术论文撰写。; 阅读建议:建议结合文档中提及的相关文献案例,按照目录结构循序渐进地学习,重点理解模型构建的逻辑框架代码现的关键细节,并利用附带的百度网盘资源获取全部代码数据文件,通过动手践加深对优化算法工程应用的理解。
内容概要:本文围绕《考虑光伏-储能-数据中心多能互补的园区容量优化配置(Matlab代码现)》这技术资源,系统研究了工业园区内光伏发电、储能系统数据中心之间的能量协同容量优化问题。通过构建融合可再生能源出力不确定性、负荷波动及数据中心算力负荷特性的数学优化模型,采用Matlab编程现多能互补系统的容量配置求解,旨在提升能源利用效率、降低运营成本碳排放,并增强园区能源系统的稳定性经济性。文中综合运用分布鲁棒机会约束(DRCC)、N-1安全准则、鲁棒优化等先进建模方法,确保方案在复杂运行环境下的可行性可靠性,适用于综合能源系统(IES)的规划调度研究。; 适合人群:面向具备电力系统、能源系统或优化算法基础的研究生、科研人员及工程技术人员,尤其适合熟悉Matlab编程及YALMIP、CPLEX等优化工具的专业人士;对于从事智慧园区、绿色数据中心或低碳能源系统研究的人员亦具有较高参考价值。; 使用场景及目标:①支撑科研项目中对数据中心的智慧园区进行多能互补建模仿真分析;②用于撰写学位论文、期刊投稿中的案例验证算法对比;③指导际工程中光伏储能容量的科学规划配置决策;④深入学习分布鲁棒优化、N-1安全约束等高级方法在能源系统中的集成应用。; 阅读建议:建议结合提供的Matlab代码逐模块解析模型现过程,重点关注目标函数构建、约束条件设定及求解器接口调用逻辑。推荐对照“顶级EI复现”案例,掌握工业级建模规范,并尝试复现关键结果以加深理解。同时可延伸学习文中关联的多时间尺度调度协同优化策略,全面提升综合能源系统的研究践能力。
内容概要:本文介绍了项基于支持向量机(SVM)的风力涡轮机故障检测技术研究,结合Matlab代码Simulink仿真平台现风力涡轮机的故障诊断容错控制。该方法利用SVM强大的分类能力对风力涡轮机运行数据进行分析,有效识别早期故障特征,提升系统可靠性安全性。资源包包完整的算法现代码、仿真模型及验数据,适用于开展风电系统智能故障诊断相关的科研工程应用。此外,文中还提及多个相关研究方向,涵盖风电系统建模、功率预测、储能优化、多能源协同调度等,展示了在新能源系统中机器学习技术的广泛应用前景。; 适合人群:具备定MATLAB/Simulink基础,从事新能源、电力系统、智能诊断或自动化方向研究的科研人员及工程技术人员,尤其适合研究生高校教师。; 使用场景及目标:① 现风力涡轮机典型故障(如传感器故障、传动链异常等)的快速检测分类;② 结合Simulink搭建风电系统仿真模型,验证SVM故障检测算法的有效性鲁棒性;③ 支持科研复现、论文写作、项目开发及教学演示等多种应用场景; 阅读建议:建议读者结合提供的Matlab代码Simulink模型进行演练,重点关注数据预处理、特征提取SVM参数调优环节,以深入掌握故障检测系统的构建流程。同时可参考文档中列出的其他研究主题拓展研究思路。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值