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: 密码

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

相关推荐
小码哥_常4 小时前
Spring Boot:别再重复造轮子,这些内置功能香麻了
后端
皮皮林5515 小时前
OpenFeign 首次调用卡 3 秒?八年老开发扒透 5 个坑,实战优化到 100ms!
后端
callJJ5 小时前
Spring Data Redis 两种编程模型详解:同步 vs 响应式
java·spring boot·redis·python·spring
海兰6 小时前
【第27篇】Micrometer + Zipkin
人工智能·spring boot·alibaba·spring ai
千寻girling6 小时前
《 Git 详细教程 》
前端·后端·面试
海兰7 小时前
【第28篇】可观测性实战:LangFuse 方案详解
人工智能·spring boot·alibaba·spring ai
0xDevNull7 小时前
Linux 中 Nginx 代理 Redis 的详细教程
redis·后端
GetcharZp8 小时前
告别 Nginx 手动配置!这款 Go 语言开发的云原生网关,才是容器化时代的真香神器!
后端
RuoyiOffice8 小时前
SpringBoot+Vue3 企业考勤如何处理法定假期?节假日方案、调休补班与工作日判断链路拆解
spring boot·后端·vue·anti-design-vue·ruoyioffice·假期·人力
xmjd msup8 小时前
spring security 超详细使用教程(接入springboot、前后端分离)
java·spring boot·spring