Invalid default: public abstract Class org.mybatis.spring.annotation.MapperScan.factoryBean()

**错误:**public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean()

**原因:**没有导入依赖MyBatis-Spring-Boot-Starter

导入依赖:

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.1.3</version>
</dependency>

注意: 

MyBatis-Spring-Boot-Starter类似一个中间件,链接Spring Boot和MyBatis,

构建基于SpringBoot的MyBatis应用程序。

MyBatis的核心有两大组件:SqlSessionFactory 和 Mapper
接口。前者表示数据库链接,后者表示SQL映射。

当我们基于Spring使用MyBatis的时候,也要保证在Spring环境中能存在着两大组件

MyBatis-Spring-Boot-Starter 将会完成以下功能:

1、Autodetect an existing DataSource
     自动发现存在的DataSource

2、Will create and register an instance of a SqlSessionFactory passing that DataSource as an input using the SqlSessionFactoryBean
    利用SqlSessionFactoryBean创建并注册SqlSessionFactory

3、Will create and register an instance of a SqlSessionTemplate got out of the SqlSessionFactory
     创建并注册SqlSessionTemplate

4、Auto-scan your mappers, link them to the SqlSessionTemplate and register them to Spring context so they can be injected into your beans
        自动扫描Mappers,并注册到Spring上下文环境方便程序的注入使用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

time Friend

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值