Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeMapper' defined in file [E:IDEASpring1028Mybatis_Spring_1101targetclassescomxiaoyuanmapperEmployeeMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:IDEASpring1028Mybatis_Spring_1101targetclassesmapperEmployeeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:IDEASpring1028Mybatis_Spring_1101targetclassesmapperEmployeeMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'Employee'. Cause: java.lang.ClassNotFoundException: Cannot find class: Employee
错误原因:
没有在配置文件中给包取别名,在我的代码中加入了
之后,问题成功解决



