SpringBoot图文教程1「概念+案例 思维导图」「基础篇上」(21)


说明:由于springboot整合mybatis启动器中会默认依赖mybatis 因此不需要单独引入mybati版本 , 否则会出现冲突

2.配置application配置文件

需要写入两种配置

  • 数据库的相关参数

  • Mybatis的mapper文件地址的配置

#数据源配置#指定驱动spring.datasource.driver-class-name=com.mysql.jdbc.Driver#指定urlspring.datasource.url=jdbc:mysql://localhost:3306/boot#指定用户名spring.datasource.username=root#指定密码spring.datasource.password=123456#指定连接池类型spring.datasource.type=com.alibaba.druid.pool.DruidDataSource复制代码#Mybatis的配置 配置mapper文件的地址mybatis.mapper-locations=classpath:mappers/*Mapper.xml复制代码

说明一下mapper-locations这个配置 如图

推荐阅读