BeanDefinitionStoreException: Failed to read candidate component class probably due to a new Java

While learning about annotations in the Spring Framework, I had this problem on my first test and couldn’t figure it out
Finally I found out that there is a mismatch between JDK and Spring version, my Spring framework version is 5.2.6 and it only supports up to JDK15 and mine is JDK16, which causes the problem
Spring Framework 5.3.x: JDK 8-17 (expected)Spring Framework 5.2.x: JDK 8-15 (expected)Spring Framework 5.1.x: JDK 8-12Spring Framework 5.0.x: JDK 8-10Spring Framework 4.3.x: JDK 6-8
I was going to download another JDK8, but suddenly I found that in File-Setting-Build, Execution... - I was able to adjust Project bytecode version from 16 to 15 in the Java Compiler and the problem was solved.


Error: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\java\spring5_demo3\out\production\spring5_demo3\com\spring5\service\UserService.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file – probably due to a new Java class file version that isn’t supported yet: file [D:\java\spring5_demo3\out\production\spring5_demo3\com\spring5\service\UserService.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 60

Read More: