mybatis一键配置

复制代码
mybaits起步依赖
XML 复制代码
     <!-- mybatis的起步依赖 -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
        </dependency>

        <!-- mysql驱动 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
复制代码
mybatis-config.xml
XML 复制代码
​​​​​​​
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC
        "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <!-- 设置驼峰标识 -->
        <setting name="mapUnderscoreToCamelCase" value="true"/>
        <!-- 打印SQL语句 -->
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    </settings>
    <plugins>
        <!-- 分页插件 -->
        <plugin interceptor="com.github.pagehelper.PageInterceptor"/>
    </plugins>
</configuration>

application-dev.xml

XML 复制代码
mybatis:
  config-location: classpath:mybatis-config.xml
  mapper-locations: classpath:/mapper/*.xml
相关推荐
DokiDoki之父8 小时前
Mybatis—入门 & (配置)SQL提示和日志输出
数据库·sql·mybatis
Lucky_Turtle1 天前
【Java Xml】dom4j写入XML
xml·java·python
莫陌尛.1 天前
xml方式bean的配置---实例化bean的方式
xml
计算机学姐2 天前
基于微信小程序的垃圾分类管理系统【2026最新】
java·vue.js·spring boot·mysql·微信小程序·小程序·mybatis
哲此一生9842 天前
SpringBoot3集成Mybatis(开启第一个集成Mybatis的后端接口)
java·spring boot·mybatis
九转苍翎2 天前
Java外功精要(3)——Spring配置文件和mybatis
spring boot·mybatis
程序员三明治3 天前
【Mybatis从入门到入土】ResultMap映射、多表查询与缓存机制全解析
java·sql·缓存·mybatis·resultmap·缓存机制·多表查询
此剑之势丶愈斩愈烈3 天前
mybatis-plus分页插件使用
mybatis
六元七角八分3 天前
pom.xml
xml·数据库
!if3 天前
springboot mybatisplus 配置SQL日志,但是没有日志输出
spring boot·sql·mybatis