org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentController': Unsatisfied dependency expressed through field 'studentService'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.mybatis.spring.SqlSessionFactoryBean] for bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: org/mybatis/spring/SqlSessionFactoryBean has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 (无法载入的类 [org.mybatis.spring.SqlSessionFactoryBean])
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
以下答案引用自GPT-3大模型,请合理使用:
出现上述错误,是由于工程使用JDK版本与Mybatis编译时使用的JDK不一致所致。可以参考以下步骤来解决:
1、检查当前工程使用的JDK版本
2、确认需要使用的Mybatis jar包,查看其使用的JDK版本;
3、重新下载支持当前使用的JDK版本的Mybatis jar包;
4、将下载的jar包添加到工程中,重新编译执行;
如果我的回答解决了您的问题,请采纳我的回答
别只放错误,代码也放上来。
看你的错误不一定就是sqlsessionFactoryBean。
studentService 有没有注入进去?
dao是否没有扫描,xml是否没有绑定