测试Mybatis有如下报错
来源:3-4 集成持久层框架Mybatis

马保国记名弟子
2021-03-02
图二报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testController’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testService’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘testMapper’ defined in file [/home/sxy/IdeaProjects/project/target/classes/com/sxy/project/mapper/TestMapper.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 org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [/home/sxy/IdeaProjects/project/target/classes/mapper/TestMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [/home/sxy/IdeaProjects/project/target/classes/mapper/TestMapper.xml]’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘com.jiawa.wiki.domain.Test’. Cause: java.lang.ClassNotFoundException: Cannot find class: com.jiawa.wiki.domain.Test
3回答
-
甲蛙
2023-03-31
看报错:Cannot find class: com.jiawa.wiki.domain.Test,找不到这个类
00 -
HelenZhao
2023-03-30
一样的错误 想问下怎么解决的呀
00 -
甲蛙
2021-03-03
看起来是注入没成功,检查下TestService类有没有加@Service注解
00
相似问题