spring-boot整合mybatis(使用Fiddler抓包工具进行测试)

本文介绍了如何在Spring Boot项目中整合Mybatis,并通过Fiddler抓包工具进行测试。首先,从Spring Initializr创建项目并导入到Eclipse。接着,添加Mybatis相关依赖和MySQL配置。在数据库中创建表并编写对应的实体类、Mapper接口及实现。通过Fiddler,可以观察HTTP请求和响应,验证查询操作的正确性。
摘要由CSDN通过智能技术生成

1、创建一个spring boot项目

打开这个网址http://start.spring.io/,直接在里面填写对应的内容,即可自动生成。然后把下载的的项目import到你的开发工具中即可。
我是用的eclipse,因此是file - - > import - - - > Existing Maven Projects - - - >选择你项目存放的路径即可。

这里写图片描述

2、添加配置依赖项pom.xml

在pom.xml中增加依赖项:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!--整合mybatis的核心依赖-->
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.0</version>
</dependency>

<!--连接mysql必要的依赖-->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
</dependency>


3、在application.properties中配置mysql的连接配置

spring.datasource.url=jdbc:mysql://localhost:3306/student
spring.datasource
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值