springboot Integrate mybatis Error: Error creating bean with name ‘deptController‘: Unsatisfied dependency expresse


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:\demo16\target\classes\com\example\demo\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; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is java.io.FileNotFoundException: class path resource [mybatis/mybaties-config.xml] cannot be opened because it does not exist

Error situation analysis.
1. mapping xml file in the namespace and resultType full class name attention to the correct reference.
2. yml file mybatis config and mapper address note that the best direct reference, not hand-typed.

Read More: