创建ApplicationContext失败,即IOC容器创建失败,往下找原因找到这条
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logInfoController': Unsatisfied dependency expressed through field 'logInfoServiceImp'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logInfoServiceImp': Unsatisfied dependency expressed through field 'logInfoDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'logInfoDao' defined in file [C:\Users\96498\Desktop\documents\hotelbook-SpringBoot\target\classes\com\earth\logInfo\dao\LogInfoDao.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 [C:\Users\96498\Desktop\documents\hotelbook-SpringBoot\target\classes\mapper\OrderInfoMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'OrderToTable'. Cause: java.lang.ClassNotFoundException: Cannot find class: OrderToTable
嵌套的最底层是这个错误
Cause: java.lang.ClassNotFoundException: Cannot find class: OrderToTable
类未找到,那点进去mapper.xml文件检查一下namespace的拼写是否正确,
不行再检查一下application.xml的别名有没有配置,这次问题就是别名未配置
在application.yml配置别名需要用" ,; "隔开,具体如下所示
type-aliases-package: com.earth.login.pojo,;com.earth.orderinfo.pojo