springboot中如何使用Mybatis
springboot集成Mybatis第一步:添加Mybatis依赖org.mybatis.spring.bootmybatis-spring-boot-starter2.0.0第二步:添加mysql驱动之所以没有版本号,因为它继承的是父工程的。当然你也可以自己指定一个版本号mysqlmysql-connector-java使用Mybatis提供的逆向工程生成实体bean,映射文件,DAO接口第一步:在项目根目录创建GeneratorMapper.xml文件,配置如下:第二步在pom.xml中配置如下:o
springboot集成Mybatis
第一步:
添加Mybatis依赖
org.mybatis.spring.boot mybatis-spring-boot-starter 2.0.0
第二步:
添加mysql驱动
之所以没有版本号,因为它继承的是父工程的。当然你也可以自己指定一个版本号
mysql mysql-connector-java

使用Mybatis提供的逆向工程 生成实体bean,映射文件,DAO接口
第一步:
在项目根目录创建 GeneratorMapper.xml 文件,配置如下:

第二步
在pom.xml中配置如下:
org.mybatis.generator mybatis-generator-maven-plugin 1.3.7 mysql mysql-connector-java 8.0.15 GeneratorMapper.xml true true
第三步
双击如下执行时,

这里有一个坑,我的在这里报错了,报错信息如下:
Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate (default-cli) on project sprint_boot_01: Communications link failure

百分之99是驱动和配置数据库信息中的connectionURL配置错了,我的解决方案:
driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/java_pro?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false"
然后在双击执行,成功:

生成的目录如下:

火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。













