项目场景:
问题描述
错误的类文件: D:\maven-repo\org\springframework\boot\spring-boot\3.1.5\spring-boot-3.1.5.jar(org/springframework/boot/SpringApplication.class)
类文件具有错误的版本 61.0, 应为 52.0`
原因分析:
SpringBoot使用了3.0或者3.0以上,因为Spring官方发布从Spring6以及SprinBoot3.0开始最低支持JDK17,而我使用的是JDK8,所以仅需将SpringBoot版本降低为3.0以下即可。
解决方案:
在pom.xml中的paren标签中将SpringBoot版本降低为3.0以下,如下所示
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.14</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>