【SpringBoot】配置 MyBatis

xml 复制代码
<!--    pom.xml    -->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>3.0.3</version>
</dependency>

<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <scope>runtime</scope>
</dependency>
properties 复制代码
# application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/my_db
spring.datasource.username=root
spring.datasource.password=root
# 实现数据库下划线字段与实体中的驼峰属性映射
mybatis.configuration.map-underscore-to-camel-case=true
yml 复制代码
# application.yml
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql//localhost:3306/mybatis
    username: root
    password: root
相关推荐
Livingbody8 分钟前
Transformers Pipeline 加载whisper模型实现语音识别ASR
后端
WindSearcher31 分钟前
大模型微调相关知识
后端·算法
考虑考虑1 小时前
Jpa中的@ManyToMany实现增删
spring boot·后端·spring
你不是我我1 小时前
【Java开发日记】说一说 SpringBoot 中 CommandLineRunner
java·开发语言·spring boot
yuan199971 小时前
Spring Boot 启动流程及配置类解析原理
java·spring boot·后端
楚歌again2 小时前
【如何在IntelliJ IDEA中新建Spring Boot项目(基于JDK 21 + Maven)】
java·spring boot·intellij-idea
洗澡水加冰2 小时前
n8n搭建多阶段交互式工作流
后端·llm
陈随易2 小时前
Univer v0.8.0 发布,开源免费版 Google Sheets
前端·后端·程序员
六月的雨在掘金3 小时前
通义灵码 2.5 | 一个更懂开发者的 AI 编程助手
后端
朱龙凯3 小时前
MySQL那些事
后端