目录

问题全程:

 这个报错是在 @autoward注入这个mapper的时候出错的 

 发现了什么, 这个包对吗, 不对

正确的导包方式@mapper

拓展 : 上面的MapStruct是一个代码生成器(大致看看吧)


问题全程:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field ***Mapper in sso.service.***  required a bean of type 'sso.mapper.*** ' 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 'sso.mapper.*** ' in your configuration.

 这个报错是在 @autoward注入这个mapper的时候出错的 

查看@mapperscan和@mapper 主要是mapper注解

发现 写了@mapper或者Mapperscan 配置没问题  

@Mapper
public interface ***Mapper extends BaseMapper<Pojo> {
}

那么这个问题怎么解决: 

看看@mapper注解的包吧

 发现了什么, 这个包对吗, 不对

正确的导包方式@mapper

import org.apache.ibatis.annotations.Mapper;

如果mapperscan出现这个问题 检查mapper文件生成的位置 

拓展 : 上面的MapStruct是一个代码生成器(大致看看吧)

它基于convention over configuration(约定优于配置)的思想,极大地简化了 Java bean 类型之间转换。

其他的百度吧 这有篇文章 看起来不错

https://www.baidu/link?url=hk-jwfSet_HF_5M8NTGWTai6O_zanGSDoWvLZffv3GiFQ7tGhj5cdo0u2qd0s7b3xiFKOAlCMGaovXUjO-YhMaScen_9zB2X8Ki2EWBPhMC&wd=&eqid=a079df7e0000044c0000000261e4ded7https://www.baidu/link?url=hk-jwfSet_HF_5M8NTGWTai6O_zanGSDoWvLZffv3GiFQ7tGhj5cdo0u2qd0s7b3xiFKOAlCMGaovXUjO-YhMaScen_9zB2X8Ki2EWBPhMC&wd=&eqid=a079df7e0000044c0000000261e4ded7

更多推荐

Consider defining a bean of type ‘mapper‘ in your configuration 问题