springboot 整合mybatis入门
一.新建springboot项目
二.第二步,以下是我已经填好的
三.选中以下两个,然后直接下一步,然后直接finish
四.打开pom文件,导入以下两个依赖
五.新建以下文件,
spring:
profiles:
active: dev
datasource:
url: jdbc:mysql://localhost:3306/maven
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
#配置mybatis参数
mybatis:
type-aliases-package: com.xiaoshu.springbootone.domain
mapper-locations: classpath:mapper/*.xml
六.编写dao 接口,和 对应的 mapper文件
itemsDao
七.编写 service 层 和 service实现类
八.编写controller 层
9.在启动类中加入 @MapperScan注解
成功