极致简单 springboot整合mybatis

2023-05-16

Springboot搭建
https://blog.csdn.net/sinat_38304393/article/details/109066952
Mybatis-generator插件安装
https://blog.csdn.net/sinat_38304393/article/details/109073641

1添加依赖 mysql mybatis

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.1.3</version>
</dependency>
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.48</version>
    <scope>runtime</scope>
</dependency>

2配置MapperScan
在这里插入图片描述

3配置 数据库 file:application.properties

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=zhuheng
spring.datasource.password=12qwaszx
spring.datasource.url=jdbc:mysql://192.168.1.47:3306/zhuheng?characterEncoding=utf-8&useSSL=false

server.port=8080

mybatis.mapper-locations=classpath:mapperXml/*.xml

logging.level.com.example.demo.dao=debug

4.测试
在这里插入图片描述

在这里插入图片描述

Successfully

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

极致简单 springboot整合mybatis 的相关文章

随机推荐