中级项目课第一个测试数据库的用例run不动
今天做到中级项目里的mybatis的第一个测试数据库例子的时候run不了InitDatabaseTests,看控制台里最先的warn是这个
WARN 8600 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDAO' defined in file [E:\java_project\toutiao1\target\classes\com\nowcoder\dao\UserDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': 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-config.xml] cannot be opened because it does not exist; 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-config.xml] cannot be opened because it does not exist
最后一句是class path resource [mybatis-config.xml] cannot be opened because it does not exist
这是因为我的mybatis-config.xml文件没放对位置吗?我就是按照视频上来的啊,也在application.properties文件里加mybatis.config-location=classpath:mybatis-config.xml这句了啊,到底怎么回事啊?求小伙伴们帮帮忙!
#Java##测试#