我打算使用spring-boot + mybits plus构建一个RESTful服务器,在Eclipse里可以正常运行。但是一旦打包放到Tomcat里就会出现如下错误(NoSuchBeanDefinition),个人推测是某些配置文件没写完整或者有错误,导致的实例注入失败。
不过我检查了很多遍,尝试了很多办法,依然还是会有这个问题。
请各路大神帮帮忙!!
目录结构:
java-xxx.xxx.xxx.xxx.dao
|-xxx.xxx.xxx.xxx.entity(也就是javaBean类)
|-xxx.xxx.xxx.xxx.service(业务逻辑接口)
|-xxx.xxx.xxx.xxx.service.impl(业务逻辑实现类)
|-xxx.xxx.xxx.xxx.controller
resource-mapper . xxx . xxx.xml
pom.xml版本信息:
mybatisplus.spring.boot.version-1.0.5
mybatis-plus-2.3
spring-boot-starter-parent-2.3
application.yml信息:
mybatis-plus部分如下
mapper-locations: classpath:mapper/**/*.xml
typeAliasesPackage: com.latou.power.modules.*.entity
Java版本-1.8.0
Tomcat版本-8.5
Tomcat报错如下:
ConfigServletWebServerApplicationContext :
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custUserController': Unsatisfied dependency expressed through field 'custUserService';nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custUserService': Unsatisfied dependency expressed through field 'baseMapper';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinition Exception: No qualifying bean of type 'com.latou.power.modules.cus.dao.CustUserDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}