springboot配置mybatis

引入依赖

配置pom.xml文件,以MySQL为例,版本自行调节,刷新Maven

java 复制代码
<!--MySQL驱动依赖        -->
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
</dependency>
<!--mybatis的起步依赖        -->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>3.0.0</version>
</dependency>

yml配置文件

配置MySQL的相关信息

java 复制代码
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:端口号/数据库名
    username: 用户名
    password: 密码

接下来就可以开始写接口啥的了

相关推荐
mldong6 小时前
从 mldong 到 jeeflow:一个工作流引擎的独立进化
后端
陈随易6 小时前
MoonBit抓包模块pcap,查看电脑的每一次联网通信
前端·后端·程序员
Aaron - Wistron7 小时前
Web API C# (Furion版)带 单元测试
开发语言·后端·c#
卷无止境7 小时前
写代码这件事,到底该讲究点什么?
后端·python
卷无止境7 小时前
循环复杂度到底在算什么,Python 代码怎么才能写得让人一看就懂
后端·python
IT_陈寒9 小时前
Vite热更新失效?你可能漏了这个配置
前端·人工智能·后端
SomeB1oody10 小时前
【RustyML入门】1.0. 快速上手
开发语言·后端·机器学习·rust·教程
史呆芬10 小时前
分布式事务实战:微服务跨服务数据一致性解决方案
java·后端·spring cloud