Latou_csdn 2018-08-03 09:02 采纳率: 0%
浏览 5217
已结题

SpringBoot在IDE可以正常运行,但是部署到Tomcat里就会启动失败

我打算使用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)}

  • 写回答

12条回答

  • 筱~破^ 2018-08-06 02:15
    关注
     <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-tomcat</artifactId>
     <scope>provided</scope>
    </dependency>
    
     <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
             <exclusions>  
                    <exclusion>  
                        <groupId>org.springframework.boot</groupId>  
                        <artifactId>spring-boot-starter-tomcat</artifactId>  
                    </exclusion>  
                </exclusions> 
        </dependency>
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器