程序启动后出现: [refresh,559] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'componentClassServiceImpl': Unsatisfied dependency expressed through field 'componentClassMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'componentClassMapper' defined in file [D:\dhqtProject\micro-base\target\classes\com\itss\base\mapper\ComponentClassMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [D:\dhqtProject\micro-base\target\classes\mapper\base\ComponentClassMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\dhqtProject\micro-base\target\classes\mapper\base\ComponentClassMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'ComponentClass'. Cause: java.lang.ClassNotFoundException: Cannot find class: ComponentClass 猜测是配置文件的问题,修改了配置文件:
重新运行发现,新的错误:我的包是com.itss.*.domain命名的,这个不对,赶紧找问题!
果然找到问题: