MyBatis xml配置文件

XML(eXtensible Markup Language)是一种可扩展的标记语言,用来描述"结构化数据"。简单说:

  • 像 HTML,但标签可以自己发明

  • 纯文本,跨平台、跨语言;

  • 核心作用:存储/传输数据,而不是展示数据。

xml

XML 复制代码
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.itheima.mapper.UserMapper">
    <select id="findall" resultType="com.itheima.pojo.User">
    select id,username,password,name,age from user
    </select>
</mapper>

辅助配置

XML 复制代码
#日志输出
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

#指定xml配置
mybaits.mapper-locations=classpath:mapper/*.xml
相关推荐
华仔啊18 小时前
挖到了 1 个 Java 小特性:var,用完就回不去了
java·后端
SimonKing19 小时前
SpringBoot整合秘笈:让Mybatis用上Calcite,实现统一SQL查询
java·后端·程序员
日月云棠1 天前
各版本JDK对比:JDK 25 特性详解
java
用户8307196840821 天前
Spring Boot 项目中日期处理的最佳实践
java·spring boot
JavaGuide1 天前
Claude Opus 4.6 真的用不起了!我换成了国产 M2.5,实测真香!!
java·spring·ai·claude code
IT探险家2 天前
Java 基本数据类型:8 种原始类型 + 数组 + 6 个新手必踩的坑
java
花花无缺2 天前
搞懂new 关键字(构造函数)和 .builder() 模式(建造者模式)创建对象
java
用户908324602732 天前
Spring Boot + MyBatis-Plus 多租户实战:从数据隔离到权限控制的完整方案
java·后端
桦说编程2 天前
实战分析 ConcurrentHashMap.computeIfAbsent 的锁冲突问题
java·后端·性能优化
程序员清风2 天前
用了三年AI,我总结出高效使用AI的3个习惯!
java·后端·面试