异常错误信息:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘deptController’: Unsatisfied dependency expressed through field ‘departmentMapper’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘departmentMapper’ defined in file [D:\IdeaWorkspace\springboot_cache\target\classes\com\roy\cache\mapper\DepartmentMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; 。。。。。。
当我们在出现这种异常的时候,可能是在我们使用spring boot 的时候,mapper文件中使用的注解方式的sql语句,并且同时存在 xxx mapper.xml ,这个时候就会出现上述异常错误。
解决方法:
只需要删除其中一种就行了。
Error creating bean with name ‘deptController‘: Unsatisfied dependency expressed....
最新推荐文章于 2024-05-18 22:05:36 发布