This is caused by the inconsistency between the selected JDK version and the version set by the compiler.
Solution:
Change the Project bytecode version: 17 under Settings -->Build, Execution, Deployment --> Complier --> Java Complier configuration to be the same as the JDK version used by the project.
At this time, the same error is still reported when starting.
Next, you have to change the maven java compiled version in pom.xml.