[SpringBoot] SpringBoot 3.0+ uses JDK new features to start an error-the class file has the wrong version 61.0, it should be 52.0 Please delete the file or ensure that the file is located in the correct classpath subdirectory

Error content

java: Cannot access org.springframework.context.annotation.Bean Error class file: /D:/maven/repository/org/springframework/spring-context/6.0.7/spring-context-6.0.7.jar!/org /springframework/context/annotation/Bean.class
class file has wrong version 61.0, should be 52.0
Please delete the file or make sure it is in the correct classpath subdirectory

insert image description here
Error reason

SpringBoot uses 3.0 or above, because the official release of Spring supports JDK17 at least starting from Spring6 and SprinBoot3.0

So just reduce the SpringBoot version to below 3.0 to
insert image description here
solve the problem

Reduce the SpringBoot version to a version below 3.0 at will, and refresh the Maven
insert image description here
test successfully
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42694422/article/details/129778017