spring:Springboot + 持久层框架JOOQ( 二 )


         </generate>
       </generator>
     </configuration>
   </plugin>
 </plugins></build>

application.properties#Copy#datasource
spring.datasource.url=jdbc:mysql://localhost:3306/demo
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

逆向工程#配置文件#在项目的resources目录下新建library.xml , 由于网上JOOQ的教程比较少 , 且比较老 , 所以建议去官网拷贝对应版本的配置文件 , 并酌情修改 , 否则会无法生成 。
Copy<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><configuration xmlns=\"http://www.jooq.org/xsd/jooq-codegen-3.12.0.xsd\">
   <!-- Configure the database connection here -->
   <jdbc>
       <driver>com.mysql.cj.jdbc.Driver</driver>
       <url>jdbc:mysql://localhost:3306/demo</url>
       <user>root</user>
       <password>123456</password>
   </jdbc>

   <generator>
       <!-- The default code generator. You can override this one to generate your own code style.Supported generators:- org.jooq.codegen.JavaGenerator-org.jooq.codegen.ScalaGenerator Defaults to org.jooq.codegen.JavaGenerator -->
       <name>org.jooq.codegen.JavaGenerator</name>

       <database>
           <!-- The database type. The format here is:
                org.jooq.meta.[database
.[database
Database -->
           <name>org.jooq.meta.mysql.MySQLDatabase</name>

           <!-- The database schema (or in the absence of schema support in your RDBMS this
                can be the owner user database name) to be generated -->
           <inputSchema>demo</inputSchema>

           <!-- All elements that are generated from your schema
                (A Java regular expression. Use the pipe to separate several expressions)
                Watch out for case-sensitivity. Depending on your database this might be important! -->
           <includes>.*</includes>

           <!-- All elements that are excluded from your schema
                (A Java regular expression. Use the pipe to separate several expressions).
                Excludes match before includes i.e. excludes have a higher priority -->