zoukankan      html  css  js  c++  java
  • springboot+mybatis,扫描不到mapper

    • 无法扫描到接口实现,'com.sclp.mapper.GenTableMapper' that could not be found.
    Description:
    
    Field genTableService in com.sclp.controller.GenController required a bean of type 'com.sclp.mapper.GenTableMapper' that could not be found.
    
    The injection point has the following annotations:
    	- @org.springframework.beans.factory.annotation.Autowired(required=true)
    
    
    Action:
    
    Consider defining a bean of type 'com.sclp.mapper.GenTableMapper' in your configuration.
    

    需要在主启动类和mapper接口上分别使用@MapperScan@Mapper,将mapper注入spring容器;

    • @MapperScan注解将非mapper接口扫描到容器,Field genTableService in com.sclp.controller.GenController required a single bean, but 2 were found
    Description:
    
    Field genTableService in com.sclp.controller.GenController required a single bean, but 2 were found:
    	- genTableServiceImpl: defined in file [D:Work_softWorkplacesclpsclp-gen	argetclassescomsclpserviceimplGenTableServiceImpl.class]
    	- IGenTableService: defined in file [D:Work_softWorkplacesclpsclp-gen	argetclassescomsclpserviceIGenTableService.class]
    
    
    Action:
    
    Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
    

    在使用@MapperScan注解时指定扫描范围@MapperScan(basePackages={"com.sclp.mapper"})

  • 相关阅读:
    mahout下的KMeans Clustering实现
    信号量、互斥体和自旋锁
    找出二叉树中两个节点的最低共同父节点
    C/C++中volatile关键字
    函数指针和指针函数
    java终止线程的通用机制
    我的一次重构实践
    新手浅谈Future
    线程中添加线程
    死锁
  • 原文地址:https://www.cnblogs.com/jinit/p/14794150.html
Copyright © 2011-2022 走看看