An error is reported when the springboot project starts
java: 无法访问org.springframework.web.bind.annotation.GetMapping
错误的类文件: /D:/Repository/org/springframework/spring-web/6.0.2/spring-web-6.0.2.jar!/org/springframework/web/bind/annotation/GetMapping.class
类文件具有错误的版本 61.0, 应为 52.0
请删除该文件或确保该文件位于正确的类路径子目录中。
The class file version mentioned in the error message refers to the java class file version. There is a correspondence between the java class file version number and the jdk version number. 61.0 corresponds to jdk17, and 52.0 corresponds to jdk8.
But my local jdk version is 1.8, and the corresponding major version is 52; the
jdk version used in the project is 17, and the corresponding major version is 61.0; the
complete correspondence can refer to this Java virtual machine document URL
https://stackoverflow.com/questions/9170832/list-of-java-class-file-format-major-version-numbers
So the version of a certain dependency is too high, reduce the version or upgrade the local jdk;
here I choose to reduce the version; the minimum requirement of SpringBoot 3.0 is that the jdkb version is 17, so spring-boot-starter-parent needs to use the 2.x version, just change the version to 2.x or less. My project
is
Please correct me if the description is wrong~ If you have any questions, you can add v 876942434, let’s make progress and grow together.