springboot集成jooq(一)

背景:基于上篇springboot整合flyway进行

一、pom.xml添加jooq相关依赖

<properties>
        <jooq.version>3.12.2</jooq.version>
    </properties>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jooq</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-meta</artifactId>
            <version>${jooq.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen</artifactId>
            <version>${jooq.version}</version>
        </dependency>

二、pom.xml增加jooq插件配置

<!-- 用于加载application.yml信息,在pom文件可读取到application.yml中信息 -->
            <plugin>
                <groupId>it.ozimov</groupId>
                <artifactId>yaml-properties-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>src/main/resources/application.yml</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- jooq的插件配置 -->
            <plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jdbc>
                        <url>${spring.datasource.url}</url>
                        <user>${spring.datasource.username}</user>
                        <password>${spring.datasource.password}</password>
                        <driver>${spring.datasource.driver-class-name}</driver>
                    </jdbc>
                    <generator>
                        <!-- 代码生成器 -->
                        <name>org.jooq.codegen.JavaGenerator</name>
                        <database>
                            <name>org.jooq.meta.postgres.PostgresDatabase</name>
                            <!--include和exclude用于控制为数据库中哪些表生成代码-->
                            <includes>.*</includes>
                            <excludes />
                            <!--schema名称-->
                            <inputSchema>myschema</inputSchema>
                        </database>
                        <target>
                            <!--生成代码文件的包名及放置目录-->
                            <packageName>com.zsx.generator.jooq</packageName>
                            <directory>src/main/java</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>

三、application增加jooq方言配置

spring:
  jooq:
    sql-dialect: POSTGRES

四、执行mvn compile命令

H:\JDK\jdk-13.0.1\bin\java.exe -Dmaven.multiModuleProjectDirectory=F:\IdeaProjects\myspringboottemplate -Dmaven.home=H:\Maven\apache-maven-3.6.2 -Dclassworlds.conf=H:\Maven\apache-maven-3.6.2\bin\m2.conf "-Dmaven.ext.class.path=H:\JetBrains\IntelliJ IDEA 2019.1.3\plugins\maven\lib\maven-event-listener.jar" -Dfile.encoding=UTF-8 -classpath H:\Maven\apache-maven-3.6.2\boot\plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version2019.2.4 -s H:\Maven\apache-maven-3.6.2\conf\settings.xml compile
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.zsx:my-springboot-template:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.scope' for org.springframework.boot:spring-boot-devtools:jar must be one of [provided, compile, runtime, test, system] but is 'true'. @ line 122, column 20
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] -------------------< com.zsx:my-springboot-template >-------------------
[INFO] Building my-springboot-template 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- yaml-properties-maven-plugin:1.1.3:read-project-properties (default) @ my-springboot-template ---
Downloading from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/yaml/snakeyaml/1.16/snakeyaml-1.16.pom
Downloaded from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/yaml/snakeyaml/1.16/snakeyaml-1.16.pom (0 B at 0 B/s)
Downloading from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar
Downloading from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
Downloaded from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar (0 B at 0 B/s)
Downloaded from aliyun: http://maven.aliyun.com/nexus/content/groups/public/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar (0 B at 0 B/s)
[INFO] 
[INFO] --- jooq-codegen-maven:3.12.2:generate (default) @ my-springboot-template ---
[INFO] No <inputCatalog/> was provided. Generating ALL available catalogs instead.
[INFO] License parameters       
[INFO] ----------------------------------------------------------
[INFO]   Thank you for using jOOQ and jOOQ's code generator
[INFO]                          
[INFO] Database parameters      
[INFO] ----------------------------------------------------------
[INFO]   dialect                : POSTGRES
[INFO]   URL                    : jdbc:postgresql://127.0.0.1:5432/mydb10
[INFO]   target dir             : F:\IdeaProjects\myspringboottemplate\src\main\java
[INFO]   target package         : com.zsx.generator.jooq
[INFO]   includes               : [.*]
[INFO]   excludes               : []
[INFO]   includeExcludeColumns  : false
[INFO] ----------------------------------------------------------
[INFO]                          
[INFO] JavaGenerator parameters 
[INFO] ----------------------------------------------------------
[INFO]   annotations (generated): true
[INFO]   annotations (JPA: any) : false
[INFO]   annotations (JPA: version): 
[INFO]   annotations (validation): false
[INFO]   comments               : true
[INFO]   comments on attributes : true
[INFO]   comments on catalogs   : true
[INFO]   comments on columns    : true
[INFO]   comments on keys       : true
[INFO]   comments on links      : true
[INFO]   comments on packages   : true
[INFO]   comments on parameters : true
[INFO]   comments on queues     : true
[INFO]   comments on routines   : true
[INFO]   comments on schemas    : true
[INFO]   comments on sequences  : true
[INFO]   comments on tables     : true
[INFO]   comments on udts       : true
[INFO]   daos                   : false
[INFO]   deprecated code        : true
[INFO]   global references (any): true
[INFO]   global references (catalogs): true
[INFO]   global references (keys): true
[INFO]   global references (links): true
[INFO]   global references (queues): true
[INFO]   global references (routines): true
[INFO]   global references (schemas): true
[INFO]   global references (sequences): true
[INFO]   global references (tables): true
[INFO]   global references (udts): true
[INFO]   indexes                : true
[INFO]   instance fields        : true
[INFO]   interfaces             : false
[INFO]   interfaces (immutable) : false
[INFO]   javadoc                : true
[INFO]   keys                   : true
[INFO]   links                  : true
[INFO]   pojos                  : false
[INFO]   pojos (immutable)      : false
[INFO]   queues                 : true
[INFO]   records                : true
[INFO]   routines               : true
[INFO]   sequences              : true
[INFO]   table-valued functions : true
[INFO]   tables                 : true
[INFO]   udts                   : true
[INFO]   relations              : true
[INFO] ----------------------------------------------------------
[INFO]                          
[INFO] Generation remarks       
[INFO] ----------------------------------------------------------
[INFO]                          
[INFO] ----------------------------------------------------------
[INFO] Generating catalogs      : Total: 1
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jooq.tools.reflect.Reflect (file:/E:/maven/repository/org/jooq/jooq/3.12.2/jooq-3.12.2.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)
WARNING: Please consider reporting this to the maintainers of org.jooq.tools.reflect.Reflect
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] ARRAYs fetched           : 0 (0 included, 0 excluded)
[INFO] Enums fetched            : 0 (0 included, 0 excluded)
[INFO] Packages fetched         : 0 (0 included, 0 excluded)
[INFO] Routines fetched         : 10 (10 included, 0 excluded)
[INFO] No schema version is applied for catalog . Regenerating.
[INFO]                          
[INFO] Generating catalog       : DefaultCatalog.java
[INFO] ==========================================================
[INFO] Generating schemata      : Total: 1
[INFO] No schema version is applied for schema myschema. Regenerating.
[INFO] Generating schema        : Myschema.java
[INFO] ----------------------------------------------------------
[INFO] Tables fetched           : 3 (3 included, 0 excluded)
[INFO] Sequences fetched        : 0 (0 included, 0 excluded)
[INFO] UDTs fetched             : 0 (0 included, 0 excluded)
[INFO] Generating tables        
[INFO] Synthetic primary keys   : 0 (0 included, 0 excluded)
[INFO] Overriding primary keys  : 2 (0 included, 2 excluded)
[INFO] Generating table         : Company.java [input=company, output=company, pk=company_pkey]
[INFO] Embeddables fetched      : 0 (0 included, 0 excluded)
[INFO] Indexes fetched          : 3 (3 included, 0 excluded)
[INFO] Generating table         : FlywaySchemaHistory.java [input=flyway_schema_history, output=flyway_schema_history, pk=flyway_schema_history_pk]
[INFO] Generating table         : TestJsonb.java [input=test_jsonb, output=test_jsonb, pk=N/A]
[INFO] Tables generated         : Total: 1.576s
[INFO] Generating table references
[INFO] Table refs generated     : Total: 1.582s, +5.519ms
[INFO] Generating Keys          
[INFO] Keys generated           : Total: 1.587s, +4.769ms
[INFO] Generating Indexes       
[INFO] Indexes generated        : Total: 1.592s, +5.175ms
[INFO] Generating table records 
[INFO] Generating record        : CompanyRecord.java
[INFO] Generating record        : FlywaySchemaHistoryRecord.java
[INFO] Generating record        : TestJsonbRecord.java
[INFO] Table records generated  : Total: 1.626s, +34.325ms
[INFO] Domains fetched          : 0 (0 included, 0 excluded)
[INFO] Generating routines and table-valued functions
[INFO] Generating routine       : UuidGenerateV1.java
[INFO] Generating routine       : UuidGenerateV1mc.java
[INFO] Generating routine       : UuidGenerateV3.java
[INFO] Generating routine       : UuidGenerateV4.java
[INFO] Generating routine       : UuidGenerateV5.java
[INFO] Generating routine       : UuidNil.java
[INFO] Generating routine       : UuidNsDns.java
[INFO] Generating routine       : UuidNsOid.java
[INFO] Generating routine       : UuidNsUrl.java
[INFO] Generating routine       : UuidNsX500.java
[INFO] Routines generated       : Total: 1.741s, +115.23ms
[INFO] Generation finished: myschema: Total: 1.742s, +0.324ms
[INFO]                          
[INFO] Removing excess files    
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ my-springboot-template ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ my-springboot-template ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 23 source files to F:\IdeaProjects\myspringboottemplate\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.214 s
[INFO] Finished at: 2019-11-03T22:17:50+08:00
[INFO] ------------------------------------------------------------------------

五、执行成功后,项目指定路径下会生成相应的文件

六、编写jooq测试类

package com.zsx.test;

import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Result;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@SpringBootTest
@ExtendWith(SpringExtension.class)
public class JooqTest {

    @Autowired
    private DSLContext dslContext;
    private com.zsx.generator.jooq.tables.Company company = com.zsx.generator.jooq.tables.Company.COMPANY.as("company");

    @Test
    void testSelect() {
        Result<Record> result = dslContext.select().from(company).fetch();
        System.out.println(result);
    }
}

七、运行测试方法

H:\JDK\jdk-13.0.1\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:H:\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=57595:H:\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath "H:\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar;H:\JetBrains\IntelliJ IDEA 2019.1.3\plugins\junit\lib\junit-rt.jar;H:\JetBrains\IntelliJ IDEA 2019.1.3\plugins\junit\lib\junit5-rt.jar;F:\IdeaProjects\myspringboottemplate\target\test-classes;F:\IdeaProjects\myspringboottemplate\target\classes;E:\maven\repository\org\springframework\boot\spring-boot-starter-web\2.2.0.RELEASE\spring-boot-starter-web-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter\2.2.0.RELEASE\spring-boot-starter-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.2.0.RELEASE\spring-boot-starter-logging-2.2.0.RELEASE.jar;E:\maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;E:\maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;E:\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.12.1\log4j-to-slf4j-2.12.1.jar;E:\maven\repository\org\apache\logging\log4j\log4j-api\2.12.1\log4j-api-2.12.1.jar;E:\maven\repository\org\slf4j\jul-to-slf4j\1.7.28\jul-to-slf4j-1.7.28.jar;E:\maven\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;E:\maven\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-json\2.2.0.RELEASE\spring-boot-starter-json-2.2.0.RELEASE.jar;E:\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.10.0\jackson-databind-2.10.0.jar;E:\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.0\jackson-annotations-2.10.0.jar;E:\maven\repository\com\fasterxml\jackson\core\jackson-core\2.10.0\jackson-core-2.10.0.jar;E:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.0\jackson-datatype-jdk8-2.10.0.jar;E:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.0\jackson-datatype-jsr310-2.10.0.jar;E:\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.0\jackson-module-parameter-names-2.10.0.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.2.0.RELEASE\spring-boot-starter-tomcat-2.2.0.RELEASE.jar;E:\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.27\tomcat-embed-core-9.0.27.jar;E:\maven\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.27\tomcat-embed-el-9.0.27.jar;E:\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.27\tomcat-embed-websocket-9.0.27.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-validation\2.2.0.RELEASE\spring-boot-starter-validation-2.2.0.RELEASE.jar;E:\maven\repository\jakarta\validation\jakarta.validation-api\2.0.1\jakarta.validation-api-2.0.1.jar;E:\maven\repository\org\hibernate\validator\hibernate-validator\6.0.17.Final\hibernate-validator-6.0.17.Final.jar;E:\maven\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;E:\maven\repository\com\fasterxml\classmate\1.5.0\classmate-1.5.0.jar;E:\maven\repository\org\springframework\spring-web\5.2.0.RELEASE\spring-web-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-beans\5.2.0.RELEASE\spring-beans-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-webmvc\5.2.0.RELEASE\spring-webmvc-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-aop\5.2.0.RELEASE\spring-aop-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-context\5.2.0.RELEASE\spring-context-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-expression\5.2.0.RELEASE\spring-expression-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-test\2.2.0.RELEASE\spring-boot-starter-test-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-test\2.2.0.RELEASE\spring-boot-test-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.2.0.RELEASE\spring-boot-test-autoconfigure-2.2.0.RELEASE.jar;E:\maven\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;E:\maven\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;E:\maven\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;E:\maven\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;E:\maven\repository\org\slf4j\slf4j-api\1.7.28\slf4j-api-1.7.28.jar;E:\maven\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.2\jakarta.xml.bind-api-2.3.2.jar;E:\maven\repository\org\junit\jupiter\junit-jupiter\5.5.2\junit-jupiter-5.5.2.jar;E:\maven\repository\org\junit\jupiter\junit-jupiter-params\5.5.2\junit-jupiter-params-5.5.2.jar;E:\maven\repository\org\junit\vintage\junit-vintage-engine\5.5.2\junit-vintage-engine-5.5.2.jar;E:\maven\repository\junit\junit\4.12\junit-4.12.jar;E:\maven\repository\org\mockito\mockito-junit-jupiter\3.1.0\mockito-junit-jupiter-3.1.0.jar;E:\maven\repository\org\assertj\assertj-core\3.13.2\assertj-core-3.13.2.jar;E:\maven\repository\org\hamcrest\hamcrest\2.1\hamcrest-2.1.jar;E:\maven\repository\org\mockito\mockito-core\3.1.0\mockito-core-3.1.0.jar;E:\maven\repository\net\bytebuddy\byte-buddy\1.10.1\byte-buddy-1.10.1.jar;E:\maven\repository\net\bytebuddy\byte-buddy-agent\1.10.1\byte-buddy-agent-1.10.1.jar;E:\maven\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;E:\maven\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;E:\maven\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;E:\maven\repository\org\springframework\spring-core\5.2.0.RELEASE\spring-core-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-jcl\5.2.0.RELEASE\spring-jcl-5.2.0.RELEASE.jar;E:\maven\repository\org\springframework\spring-test\5.2.0.RELEASE\spring-test-5.2.0.RELEASE.jar;E:\maven\repository\org\xmlunit\xmlunit-core\2.6.3\xmlunit-core-2.6.3.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-jooq\2.2.0.RELEASE\spring-boot-starter-jooq-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-starter-jdbc\2.2.0.RELEASE\spring-boot-starter-jdbc-2.2.0.RELEASE.jar;E:\maven\repository\com\zaxxer\HikariCP\3.4.1\HikariCP-3.4.1.jar;E:\maven\repository\org\springframework\spring-jdbc\5.2.0.RELEASE\spring-jdbc-5.2.0.RELEASE.jar;E:\maven\repository\jakarta\activation\jakarta.activation-api\1.2.1\jakarta.activation-api-1.2.1.jar;E:\maven\repository\org\springframework\spring-tx\5.2.0.RELEASE\spring-tx-5.2.0.RELEASE.jar;E:\maven\repository\org\jooq\jooq\3.12.2\jooq-3.12.2.jar;E:\maven\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;E:\maven\repository\org\jooq\jooq-meta\3.12.2\jooq-meta-3.12.2.jar;E:\maven\repository\org\jooq\jooq-codegen\3.12.2\jooq-codegen-3.12.2.jar;E:\maven\repository\org\glassfish\jaxb\jaxb-core\2.3.0.1\jaxb-core-2.3.0.1.jar;E:\maven\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;E:\maven\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;E:\maven\repository\org\glassfish\jaxb\txw2\2.3.2\txw2-2.3.2.jar;E:\maven\repository\com\sun\istack\istack-commons-runtime\3.0.5\istack-commons-runtime-3.0.5.jar;E:\maven\repository\com\sun\xml\bind\jaxb-impl\2.3.2\jaxb-impl-2.3.2.jar;E:\maven\repository\org\postgresql\postgresql\42.2.8\postgresql-42.2.8.jar;E:\maven\repository\com\alibaba\fastjson\1.2.62\fastjson-1.2.62.jar;E:\maven\repository\org\projectlombok\lombok\1.18.10\lombok-1.18.10.jar;E:\maven\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.1.1\mybatis-spring-boot-starter-2.1.1.jar;E:\maven\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.1.1\mybatis-spring-boot-autoconfigure-2.1.1.jar;E:\maven\repository\org\mybatis\mybatis\3.5.3\mybatis-3.5.3.jar;E:\maven\repository\org\mybatis\mybatis-spring\2.0.3\mybatis-spring-2.0.3.jar;E:\maven\repository\org\flywaydb\flyway-core\6.0.7\flyway-core-6.0.7.jar;E:\maven\repository\com\google\guava\guava\28.1-jre\guava-28.1-jre.jar;E:\maven\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;E:\maven\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;E:\maven\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;E:\maven\repository\org\checkerframework\checker-qual\2.8.1\checker-qual-2.8.1.jar;E:\maven\repository\com\google\errorprone\error_prone_annotations\2.3.2\error_prone_annotations-2.3.2.jar;E:\maven\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;E:\maven\repository\org\codehaus\mojo\animal-sniffer-annotations\1.18\animal-sniffer-annotations-1.18.jar;E:\maven\repository\org\junit\platform\junit-platform-launcher\1.5.2\junit-platform-launcher-1.5.2.jar;E:\maven\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;E:\maven\repository\org\junit\platform\junit-platform-engine\1.5.2\junit-platform-engine-1.5.2.jar;E:\maven\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;E:\maven\repository\org\junit\platform\junit-platform-commons\1.5.2\junit-platform-commons-1.5.2.jar;E:\maven\repository\org\junit\jupiter\junit-jupiter-engine\5.5.2\junit-jupiter-engine-5.5.2.jar;E:\maven\repository\org\junit\jupiter\junit-jupiter-api\5.5.2\junit-jupiter-api-5.5.2.jar;E:\maven\repository\org\springframework\boot\spring-boot-devtools\2.2.0.RELEASE\spring-boot-devtools-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot\2.2.0.RELEASE\spring-boot-2.2.0.RELEASE.jar;E:\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.0.RELEASE\spring-boot-autoconfigure-2.2.0.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit5 com.zsx.JooqTest,testSelect
22:47:02.326 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
22:47:02.376 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
22:47:02.432 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.zsx.JooqTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
22:47:02.496 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.zsx.JooqTest], using SpringBootContextLoader
22:47:02.503 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zsx.JooqTest]: class path resource [com/zsx/JooqTest-context.xml] does not exist
22:47:02.504 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zsx.JooqTest]: class path resource [com/zsx/JooqTestContext.groovy] does not exist
22:47:02.504 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.zsx.JooqTest]: no resource found for suffixes {-context.xml, Context.groovy}.
22:47:02.507 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.zsx.JooqTest]: JooqTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
22:47:02.615 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.zsx.JooqTest]
22:47:02.776 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [F:\IdeaProjects\myspringboottemplate\target\classes\com\zsx\MySpringbootTemplateApplication.class]
22:47:02.778 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.zsx.MySpringbootTemplateApplication for test class com.zsx.JooqTest
22:47:03.009 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.zsx.JooqTest]: using defaults.
22:47:03.010 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
22:47:03.040 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@5c669da8, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@31920ade, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@1d483de4, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4032d386, org.springframework.test.context.support.DirtiesContextTestExecutionListener@28d18df5, org.springframework.test.context.transaction.TransactionalTestExecutionListener@934b6cb, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@55cf0d14, org.springframework.test.context.event.EventPublishingTestExecutionListener@3b74ac8, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@27adc16e, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@b83a9be, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@2609b277, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@1fd14d74, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@563e4951]
22:47:03.047 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@2931522b testClass = JooqTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@7674b62c testClass = JooqTest, locations = '{}', classes = '{class com.zsx.MySpringbootTemplateApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6497b078, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@46fa7c39, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@52102734, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3e6ef8ad], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jooq.tools.reflect.Reflect (file:/E:/maven/repository/org/jooq/jooq/3.12.2/jooq-3.12.2.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)
WARNING: Please consider reporting this to the maintainers of org.jooq.tools.reflect.Reflect
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
22:47:03.669 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.0.RELEASE)

2019-11-03 22:47:04.665  INFO 6400 --- [           main] com.zsx.JooqTest                         : Starting JooqTest on zsx with PID 6400 (started by admin in F:\IdeaProjects\myspringboottemplate)
2019-11-03 22:47:04.667  INFO 6400 --- [           main] com.zsx.JooqTest                         : No active profile set, falling back to default profiles: default
2019-11-03 22:47:06.429  WARN 6400 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.zsx]' package. Please check your configuration.
2019-11-03 22:47:07.587  INFO 6400 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-03 22:47:08.236  INFO 6400 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 6.0.7 by Redgate
2019-11-03 22:47:08.266  WARN 6400 --- [           main] com.zaxxer.hikari.HikariConfig           : HikariPool-1 - idleTimeout has been set but has no effect because the pool is operating as a fixed size pool.
2019-11-03 22:47:08.267  INFO 6400 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-11-03 22:47:08.586  INFO 6400 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2019-11-03 22:47:08.645  INFO 6400 --- [           main] o.f.c.internal.database.DatabaseFactory  : Database: jdbc:postgresql://127.0.0.1:5432/mydb10 (PostgreSQL 12.0)
2019-11-03 22:47:08.706  INFO 6400 --- [           main] o.f.core.internal.command.DbValidate     : Successfully validated 2 migrations (execution time 00:00.042s)
2019-11-03 22:47:08.724  INFO 6400 --- [           main] o.f.core.internal.command.DbMigrate      : Current version of schema "myschema": 1
2019-11-03 22:47:08.725  INFO 6400 --- [           main] o.f.core.internal.command.DbMigrate      : Schema "myschema" is up to date. No migration necessary.
2019-11-03 22:47:09.417  INFO 6400 --- [           main] com.zsx.JooqTest                         : Started JooqTest in 5.679 seconds (JVM running for 9.395)

+----+-----+----+--------------------------------------------------+-------+----------+
|  id|name | age|address                                           | salary|join_date |
+----+-----+----+--------------------------------------------------+-------+----------+
|   1|Paul |  32|California                                        |20000.0|2001-07-13|
|   2|Allen|  25|Texas                                             | {null}|2007-12-13|
|   3|Teddy|  23|Norway                                            |20000.0|{null}    |
|   4|Mark |  25|Rich-Mond                                         |65000.0|2007-12-13|
|   5|David|  27|Texas                                             |85000.0|2007-12-13|
+----+-----+----+--------------------------------------------------+-------+----------+


2019-11-03 22:47:10.690  INFO 6400 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2019-11-03 22:47:10.857  INFO 6400 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2019-11-03 22:47:10.859  INFO 6400 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Process finished with exit code 0

从以上结果可以看出集成jooq成功

发布了129 篇原创文章 · 获赞 14 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/zsx18273117003/article/details/102887513