Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of documents for Rapid Development of Springboot2.X + screw Database

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about the example analysis of Springboot2.X + screw database rapid development documents, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

1. Pom dependency

Create a springboot project and add dependencies

Org.freemarker freemarker 2.3.30 cn.smallbun.screw screw-core 1.0.3 2, generate documentation test class

The following is the path of Lao Meng's own computer, and manually switch the path of your work computer.

This demo code environment is in the SpringBoot environment, this aside, the general idea one-click creation of SpringBoot Maven project Boot depends on automatic entry

Package com.atxiaodei.springcloud.util;import cn.smallbun.screw.core.Configuration;import cn.smallbun.screw.core.engine.EngineConfig;import cn.smallbun.screw.core.engine.EngineFileType;import cn.smallbun.screw.core.engine.EngineTemplateType;import cn.smallbun.screw.core.execute.DocumentationExecute;import cn.smallbun.screw.core.process.ProcessConfig;import com.zaxxer.hikari.HikariConfig;import com.zaxxer.hikari.HikariDataSource;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired Import org.springframework.boot.test.context.SpringBootTest;import org.springframework.context.ApplicationContext;import javax.sql.DataSource;import java.util.ArrayList;import java.util.Arrays;import java.util.List;@SpringBootTestpublic class ScrewApplicationTests {@ Autowired ApplicationContext applicationContext; @ Testpublic void runTest () {/ / data source HikariConfig hikariConfig = new HikariConfig (); hikariConfig.setDriverClassName ("com.mysql.cj.jdbc.Driver") / / z Note: be sure to switch to your own data source hikariConfig.setJdbcUrl ("jdbc:mysql://XXXXXX:3306/hwswgp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"); hikariConfig.setUsername ("XXXXXX"); hikariConfig.setPassword ("XXXXXX"); / / set to get tables remarks information hikariConfig.addDataSourceProperty ("useInformationSchema", "true"); hikariConfig.setMinimumIdle (2) HikariConfig.setMaximumPoolSize (5); DataSource dataSource = new HikariDataSource (hikariConfig) / / generate configuration EngineConfig engineConfig = EngineConfig.builder () / / generate file path Note: here you also need to switch to your own data source .fileOutputDir ("C://Users/issuser/Desktop") / / Open the directory .openOutputDir (false) / / File Type Note here to see what format you want to generate. There are three formats, word,MD. Html .fileType (EngineFileType.WORD) / / generate template implementation .produceType (EngineTemplateType.freemarker) .build () / / ignore table ArrayList ignoreTableName = new ArrayList (); ignoreTableName.add ("test_user"); ignoreTableName.add ("test_group"); / / ignore table prefix ArrayList ignorePrefix = new ArrayList (); ignorePrefix.add ("test_"); / / ignore table suffix ArrayList ignoreSuffix = new ArrayList (); ignoreSuffix.add ("_ test") ProcessConfig processConfig = ProcessConfig.builder () / / specify the generation logic. When there is a specified table, a specified table prefix, or a specified table suffix, the specified table will be generated. The rest of the tables are not generated, And skip ignore table configuration / / specify table by name to generate .accounatedTableName (new ArrayList ()) / / generate .SecretatedTablePrefix (new ArrayList ()) / based on table suffix. IgnoratedTableSuffix (new ArrayList ()) / / ignore table name .accounreTableName (ignoreTableName) / / ignore table prefix. .roomreTablePrefix (ignorePrefix) / / ignores the table suffix .SecretreTableSuffix (ignoreSuffix) .build () / / configure Configuration config = Configuration.builder () / / version ("1.0.0") / / describe .description ("database design document generation") / / data source .dataSource (dataSource) / / build configuration .engineConfig (engineConfig) / / build configuration .produceConfig (processConfig) .build () / / generate new DocumentationExecute (config) .execute ();}} 3. Start

Click test to launch and run the result. Export html format is supported. The word,MD format is as follows

MD file format:

After reading the above, do you have any further understanding of the sample analysis of Springboot2.X + screw database rapid development documents? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report