【spring-boot与spring-context 版本依赖冲突】

问题描述

Action: Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.SpringApplication and org.springframework.context.ConfigurableApplicationContext

Description: 
An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.boot.SpringApplication.run(SpringApplication.java:306) 

The following method did not exist: 

org.springframework.context.ConfigurableApplicationContext.setApplicationStartup(Lorg/springframework/core/metrics/ApplicationStartup;)V 

The calling method's class, org.springframework.boot.SpringApplication, was loaded from the following location: jar:file:/.m2/repository/org/springframework/boot/spring-boot/x.x.x/spring-boot-x.x.x.jar!/org/springframework/boot/SpringApplication.class 

The called method's class, org.springframework.context.ConfigurableApplicationContext, is available from the following locations: jar:file:/.m2/repository/org/springframework/spring-context/x.x.x.RELEASE/spring-context-x.x.x.RELEASE.jar!/org/springframework/context/ConfigurableApplicationContext.class 

The called method's class hierarchy was loaded from the following locations: org.springframework.context.ConfigurableApplicationContext: file:/.m2/repository/org/springframework/spring-context/x.x.x.RELEASE/spring-context-x.x.x.RELEASE.jar 

解决方案

  1. 错误信息表明的 Spring Boot 应用中 spring-boot 和 spring-context 的版本不匹配。正在使用的是
    spring-boot 版本 2.7.17 和 spring-context 版本 5.2.6.RELEASE。这两个版本是不兼容的。

  2. 解决方案:将 Spring Boot 和 Spring Context 的版本对齐。对于 Spring Boot
    2.7.17,应该使用兼容的 Spring Framework 版本,通常是在同一个主要版本和次要版本范围内的版本。查阅 Spring Boot 文档,找出与 2.7.17 兼容的 Spring Framework 版本,并相应地更新的 spring-context 依赖。

  3. 答主这里是2.7.17与5.2.6.RELEASE 有冲突,具体各位项目中的使用情况,需要单独查询。答主将spring-context的依赖调整成5.3.30后解决。

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值