springBoot 整合mybaits 逆向工程
pom.xml文件中增加配置项
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.hna.dbp.zuul.Application</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<dependencies>
<dependency>
<groupId> mysql</groupId>
<artifactId> mysql-connector-java</artifactId>
<version>5.1.27</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>package</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<!--允许移动生成的文件 -->
<verbose>true</verbose>
<!-- 是否覆盖 -->
<overwrite>false</overwrite>
<!-- 配置文件位置 -->
<configurationFile>
src/main/resources/prod/mybatis-generator.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
创建配置文件 mybatis-generator.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--mysql 连接数据库jar 这里选择自己本地位置-->
<classPathEntry location="D:\repository2\mysql\mysql-connector-java\5.1.35\mysql-connector-java-5.1.35.jar" />
<context id="testTables" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.100.166:3306/api_gateway?serverTimezone=UTC" userId="root"
password="123456">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver> <!-- targetProject:生成PO类的位置 -->
<javaModelGenerator targetPackage="com.hna.dbp.zuul.dao.entity"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置
如果maven工程只是单独的一个工程,targetProject="src/main/java"
若果maven工程是分模块的工程,targetProject="所属模块的名称",例如:
targetProject="ecps-manager-mapper",下同-->
<sqlMapGenerator targetPackage="com.hna.dbp.zuul.dao.mapper"
targetProject="src/main/resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackage:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.hna.dbp.zuul.dao.mapper"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 指定数据库表 多个表示,可用多个table标签-->
<table tableName="apis_zuul"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
</context>
</generatorConfiguration>
run >maven build > mybatis-generator:generate

springBoot 整合mybaits 逆向工程的更多相关文章
- springboot整合mybaits注解开发
		
springboot整合mybaits注解开发时,返回json或者map对象时,如果一个字段的value为空,需要更改springboot的配置文件 mybatis: configuration: c ...
 - SpringBoot 3.SpringBoot 整合 MyBatis 逆向工程以及 MyBatis 通用 Mapper
		
一.添加所需依赖,当前完整的pom文件如下: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&qu ...
 - springboot整合mybatis-plus逆向工程
		
MyBatis-Plus(简称 MP)是一个 MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发.提高效率而生.官方文档 代码生成器 AutoGenerator 是 ...
 - spring-boot整合mybaits多数据源动态切换案例
		
1.运行环境 开发工具:intellij idea JDK版本:1.8 项目管理工具:Maven 4.0.0 2.GITHUB地址 https://github.com/nbfujx/springBo ...
 - SpringBoot整合mybatis踩坑
		
springboot整合mybaits过程中,调用接口时报错:org.apache.ibatis.binding.BindingException: Invalid bound statement ( ...
 - springboot整合mybatis,freemarker
		
springboot 整合mybaits,,freemarker pom.xml文件 <?xml version="1.0" encoding="UTF-8&quo ...
 - SpringBoot 整合 Mybatis 进行CRUD测试开发
		
今天来和大家分享下 Spring Boot 整合 MyBatis 的 CRUD 测试方法开发.因为 MyBaits 有两种开发形式,一种基于注解,一种基于 xml . SpringBoot配置文件也有 ...
 - springboot集成mybatis(逆向工程),热部署以及整合Swagger2
		
本文是作者原创,版权归作者所有.若要转载,请注明出处. springboot集成mybatis和mybatis-generator插件 1.新建Springboot项目(略) 2.导入相关依赖 < ...
 - SpringBoot (四) - 整合Mybatis,逆向工程,JPA
		
1.SpringBoot整合MyBatis 1.1 application.yml # 数据源配置 spring: datasource: driver-class-name: com.mysql.c ...
 
随机推荐
- 秒懂 this(带你撸平this)
			
本文讲述只针对浏览器环境. 一:全局执行 console.log(this); // Window 可以看出在全局作用域中 this 指向当前的全局对象 Window. 二:函数中执行 1. 非严格模 ...
 - 发布npm
			
前言 我们npm publish发布的时候,一定是本地文件发布到远程仓库,并且登录到http://registry.npmjs.org(即npm adduser或npmlogin)之后,才可以进行发布 ...
 - 牛客网多校第3场C-shuffle card 平衡树或stl(rope)
			
链接:https://www.nowcoder.com/acm/contest/141/C 来源:牛客网 题目描述 Eddy likes to play cards game since there ...
 - private、public、protected和默认
			
类中的域最好标记为private: 方法最好标记为public: private:仅对本类可见 public:对所有类可见 protected:对本包和对所有子类可见 默认(什么都不写):对本包可见 ...
 - Jsの数组练习-求一组数中的最大值和最小值,以及所在位置
			
要求:求一组数中的最大值和最小值,以及所在位置 代码实现: <!DOCTYPE html> <html lang="en"> <head> &l ...
 - git的基本用法——我的日常使用
			
git的基本用法 一,前言 网上有太多关于git的用法说明,而我看得云里雾里,可能是本人比较愚笨.平常时间老问别人又觉得很不好意思,估计大多的同学们都是自己解决.后来我想到了买一本书,淘宝上git书籍 ...
 - jquery mCustomScrollbar 滚动条宽度的设置
			
一.项目使用 $("#iscroll-1, #tree_box, .work, .item1, .item2, .item3, .item4").mCustomScrollbar( ...
 - 两个1/x类的广义函数
			
[转载请注明出处]http://www.cnblogs.com/mashiqi 2017/04/15 1.$\text{p.v.}\,\frac{1}{x}$ 因为$(x \ln x - x)' = ...
 - JUnit4测试报错:class not found  XXX
			
初学java框架,最近用eclipse跟着视频坐淘淘商城这个项目,其中使用了JUnit4做单元测试.当运行测试代码时,项目报错:class not found xxx. 借助了其他大神的博客,论坛等 ...
 - js数字自执行随机滚动
			
每三秒执行一次,若是需要触发执行,可添加一个单击事件.<!DOCTYPE HTML> <html> <head> <meta http-equiv=" ...