spring boot整合jooq
專案結構:
JooqConfig.xml全文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://11.23.98.90/tableName</url>
<user>root</user>
<password>P@ssw0rd</password>
</jdbc>
<generator>
<!-- 程式碼生成器 -->
<name>org.jooq.util.JavaGenerator</name>
<database>
<!--下面這兩行是為view也生成程式碼的關鍵-->
<!--force generating id'sfor everything in public schema, that has an 'id' field-->
<syntheticPrimaryKeys>public\..*\.id</syntheticPrimaryKeys>
<!--name for fake primary key-->
<overridePrimaryKeys>override_primmary_key</overridePrimaryKeys>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<!--include和exclude用於控制為資料庫中哪些表生成程式碼-->
<includes>.*</includes>
<!--<excludes></excludes>-->
<!--資料庫名稱-->
<inputSchema>suntree_cmp_test</inputSchema>
</database>
<generate>
<!--生成dao和pojo-->
<daos>true</daos>
<pojos>true</pojos>
<!--把資料庫時間型別對映到java 8時間型別-->
<javaTimeTypes>true</javaTimeTypes>
<!--<interfaces>true</interfaces>-->
<!--不在生成的程式碼中新增spring註釋,比如@Repository-->
<springAnnotations>false</springAnnotations>
</generate>
<target>
<!--生成程式碼檔案的包名及放置目錄-->
<packageName>cn.com.suntree.generator</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
dependencies中加入
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
</dependency>
plugins中加入
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
<configuration>
<configurationFile>src/main/resources/JooqConfig.xml</configurationFile>
</configuration>
</plugin>
需要注意的都在JoopConfig.xml中做了註釋
最後執行maven的compile
將會自動生成一些程式碼
初步整合成功
相關文章
- Spring Boot整合Spring BatchSpring BootBAT
- Spring Boot整合Spring AopSpring Boot
- Spring Boot整合Spring SecuritySpring Boot
- Spring Boot系列十九 Spring boot整合 swaggerSpring BootSwagger
- Spring Boot 2.0(八):Spring Boot 整合 MemcachedSpring Boot
- Spring Boot 整合 KafkaSpring BootKafka
- Spring Boot 整合 MyBatisSpring BootMyBatis
- Spring Boot整合SwaggerSpring BootSwagger
- Spring Boot整合rabbitmqSpring BootMQ
- Spring Boot整合RedisSpring BootRedis
- Spring Boot 整合redisSpring BootRedis
- Spring Boot 整合 rabbitmqSpring BootMQ
- Spring Boot 整合 elasticsearchSpring BootElasticsearch
- Spring Boot 整合 dockerSpring BootDocker
- Spring Boot 整合 elkSpring Boot
- Spring Boot 整合 ApolloSpring Boot
- spring boot整合shiroSpring Boot
- spring boot整合HadoopSpring BootHadoop
- Spring Boot整合SocketSpring Boot
- Spring boot學習(三) Spring boot整合mybatisSpring BootMyBatis
- Spring boot學習(四)Spring boot整合DruidSpring BootUI
- Spring Boot:整合Spring Data JPASpring Boot
- 使用Spring Boot整合ConsulSpring Boot
- Spring-Boot整合RedisSpringbootRedis
- 【Spring Boot】快速整合SwaggerSpring BootSwagger
- Spring Boot 快速整合SwaggerSpring BootSwagger
- spring boot(三)整合 redisSpring BootRedis
- Spring Boot Actuator 整合 PrometheusSpring BootPrometheus
- Spring Boot 整合 Apache DubboSpring BootApache
- ElasticSearch與Spring Boot整合ElasticsearchSpring Boot
- Spring Boot整合Spring Cloud Netflix元件Spring BootCloud元件
- spring-boot 整合 spring-securitySpringboot
- spring-boot 整合 spring-sessionSpringbootSession
- Spring Boot系列(三):Spring Boot整合Mybatis原始碼解析Spring BootMyBatis原始碼
- Spring boot學習(五)Spring boot整合Mybatis Generator以及PageHelperSpring BootMyBatis
- Spring Boot 整合 xxl-jobSpring Boot
- Spring Boot 整合 Logback 日誌Spring Boot
- Spring Boot整合 Geodesy講解Spring Boot