0


源发行版本 17 需要目标发行版 17

源发行版本 17 需要目标发行版 17问题解决

1.版本不匹配问题,让Java Compiler里面的版本一致

在这里插入图片描述

2.再次运行时,还是报错:springframework/boot/SpringApplication has been compiled by a more recent version of the Java Runtime .(class file version 61.0), this version of the Java Runtime only recognizes (class file versions up to 55.0)

springframework/boot/SpringApplication 
has been compiled by a more recent version of the JavaRuntime.(class file version 61.0),this version of the JavaRuntime only recognizes 
(class file versions up to55.0)

解决办法:点击File—>点击Project Structure—>点击Module—>Language level改为11
在这里插入图片描述
在这里插入图片描述

3.又运行,报错:/C:/Users/.m2/repository/org/springframework/boot/spring-boot/3.0.4/spring-boot-3.0.4.jar!/org/springframework/boot/SpringApplication.class类文件具有错误的版本 61.0, 应为 55.0,请删除该文件或确保该文件位于正确的类路径子目录中。

原因是SpringBoot使用了3.0或者3.0以上,Spring官方发布从Spring6以及SprinBoot3.0开始最低支持JDK17,需要将SpringBoot版本降低为3.0以下。

3.0.4更改为2.7.5
在这里插入图片描述
17改为11
在这里插入图片描述
刷新Maven,重新启动即可

4.再次运行是,又报错:Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context

publicclass APP {publicstaticvoidmain(String[] args){SpringApplication.run(APP.class);}}

缺失了@SpringBootApplication
终于解决了!

标签: spring boot

本文转载自: https://blog.csdn.net/weixin_41796772/article/details/129455164
版权归原作者 shs520 所有, 如有侵权,请联系我们删除。

“源发行版本 17 需要目标发行版 17”的评论:

还没有评论