type
status
date
slug
summary
tags
category
icon
password

一、搭建环境

创建数据库表

新建项目

导入依赖

二、创建一个模块

在resources文件夹下编写Mybatis的核心配置文件mybatis-config.xml

编写Mybatis工具类

编写实体类

编写一个接口

接口实现类由原来的UserDaoImpl转变为一个Mapper配置文化

三、测试

junit测试

测试结果

没配置Mapper注册表
xml文件未加载问题,因为maven约定大于配置 在pom.xml上配置一下resources
 

最后运行结果

notion image
Linux安装mysqlMybatis简介
  • Giscus
  • Utterance