标题SpringBoot整合Mybatis逆向生成工具
今天在给大家带来一个偷懒小技巧——SpringBoot整合Mybatis逆向生成工具!!!
其实我整合这个并不是因为项目需要,而是单纯的想偷懒
我的项目是ssm的,每次手敲实体类还有改xml文件都很烦,而且经常敲错一个字母或者改错一个字母。找的头都大了,所以就想到了这个方法来提高效率(偷懒)。
A:首先先创建一个项目
这里新建项目是因为我需要的是他的实体类和xml文件,如果你在做的项目刚好是SpringBoot的就可以整合到你的项目里或者以这个为基础来做东西。
B:在resources下新建yml
spring:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://128.64.151.217:3306/duty?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
username: root
password: root
mybatis:
type-aliases-package: com.ssm.demo.entity
mapper-locations: classpath*:mapper/*.xml
C:要搞POM文件了(我直接全搞过来了,各位选自己需要的就好了)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ssm</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>