SpringBoot 集合mybatis代码生成器

本文介绍了如何在SpringBoot项目中集成Mybatis代码生成器,通过配置pom.xml,设置application.properties和hikari.properties,创建templates文件夹并编写html模板,实现了根据数据库表自动生成controller、domain、dao和mapper文件。在数据库表结构变更后,需删除原有文件以避免错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目git地址:https://github.com/ricky739996585/BaseSpringBoot.git


1.用idea 创建一个springboot项目(如果用eclipse开发,下载spring-tools-suite来创建springboot项目):

这里不详细介绍如何创建了,有一个关键需要注意的是:


2.在原本的pom.xml中加入以下以来:

<!-- springboot热部署依赖 -->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
</dependency>
<!-- mysql依赖 -->
<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 高性能JDBC连接池组件 ,性能比常用的 c3p0、tomcat、bone、vibur 这些要高很多 -->
<dependency>
   <groupId>com.zaxxer</groupId>
   <artifactId>HikariCP</artifactId>
   <!-- 版本号可以不用指定,Spring Boot会选用合适的版本 -->
</dependency>
<!-- mybatis -->
<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值