type
status
date
slug
summary
tags
category
icon
password
一、搭建环境创建数据库表导入依赖二、创建一个模块在resources文件夹下编写Mybatis的核心配置文件mybatis-config.xml编写Mybatis工具类编写实体类编写一个接口接口实现类由原来的UserDaoImpl转变为一个Mapper配置文化三、测试junit测试测试结果最后运行结果
一、搭建环境
创建数据库表
新建项目
导入依赖
二、创建一个模块
在resources文件夹下编写Mybatis的核心配置文件mybatis-config.xml
编写Mybatis工具类
编写实体类
编写一个接口
接口实现类由原来的UserDaoImpl转变为一个Mapper配置文化
三、测试
junit测试
测试结果
没配置Mapper注册表
xml文件未加载问题,因为maven约定大于配置 在pom.xml上配置一下
resources
最后运行结果
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffff7510b-00b0-460e-a3be-cff4d4053e68%2FUntitled.png?table=block&id=1d25d03e-f4b6-48d3-9c11-2841dbba0f0b&t=1d25d03e-f4b6-48d3-9c11-2841dbba0f0b&width=826&cache=v2)
- Author:内河大魔王
- URL:https://ltyzqhh.top/dcb16c42917d4c0597b62c501d1599f8
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!