type:: note status:: apply star:: 5 relation:: [notion](https://www.notion.so/TODO-TPI-TPIU-Thymeleaf-and-Bootstrap-by-Bootify-b22a0d0b97944f838892a01bc7886611?pvs=4), [gist](https://gist.github.com/wanyutang/8f5d958438b177c26ae7c14cca367d00),[hackmd↗](https://hackmd.io/JM1HwEc-Q9-G7c5179xhlw) - # 使用 Bootify 快速生成 Spring Boot 程式架構 - This article is the original draft, published at [[TPIU 昕力大學]][↗](https://www.tpisoftware.com/tpu/). - ## 簡介 - Bootify 是一個強大且便利的工具,幫助開發者快速生成專案的基礎架構。它支援生成實體類、配置資料庫、UI 以及專案基本設置,對於需要高效構建專案骨架的開發者來說,是一個不可或缺的工具。 - ## 如何使用 Bootify 設置專案 - **Bootify 官網首頁**: {:width 300, :height 232} - 進入Bootify 官網首頁選擇 [Start Project] 開始建置專案 - **選擇專案模板**: {:width 300} - Bootify 提供多種專案模板,方便選擇合適的架構來快速生成基礎項目。 - **設定實體類選項如下**: {:width 300} - 可自動生成符合需求的實體類,並設置關聯關係及欄位屬性。 - **配置資料庫連線選項如下**: {:width 300, :height 140} - 輕鬆完成資料庫配置,支援多種資料庫類型,確保資料存取與操作的穩定性。 - PS. 部份連線模式需要升級成高級會員方能生效。 - ## 使用 Bootify 進行 UI 配置 - **選擇UI模板**: {:width 300} - Bootify 提供簡單的 UI 配置介面,支援 Thymeleaf 與 Bootstrap 的集成,可以快速生成前端頁面,滿足專案需求。開發者只需通過圖形化界面操作,即可生成完整的 UI 架構,省去手動編寫前端代碼的時間。 - ## 開發環境設置與部署 - **開發模式配置**: {:width 300} - Bootify 支援本地與雲端環境的開發模式設置,並提供各種運行配置選項,方便在不同環境下調整設定。 - **Entities配置**: {:width 300} - **Schema 建置 Entity **: {:width 300} - [SQL Schema Sample.sql.gist](https://gist.github.com/wanyutang/12af70ac910326412b8806cfa81784e4)[^1] - **Schema 架構圖**: {:width 300} - **Schema Perform import**: {:width 300} - ## 下載與部署專案 - Bootify 支援 Maven 項目配置,專案生成後可直接下載並在本地 Intellij 中打開,並進行編譯、執行。 - **Download-執行**: {:width 300} - **Download-完成**: {:width 300} - **本機取得建置成果**: {:width 300} - **Intellij 匯入專案**: {:width 300} - **同意信任專案**: {:width 300} - **專案結構**: {:width 300} - POM.xml - ```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.3.3</version> <relativePath /><!-- lookup parent from repository --> </parent> <groupId>io.bootify</groupId> <artifactId>my-app</artifactId> <version>0.0.1-SNAPSHOT</version> <name>my-app</name> <properties> <java.version>17</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>io.github.wimdeblauwe</groupId> <artifactId>error-handling-spring-boot-starter</artifactId> <version>4.3.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>nz.net.ultraq.thymeleaf</groupId> <artifactId>thymeleaf-layout-dialect</artifactId> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>5.3.3</version> </dependency> <dependency> <groupId>org.webjars.npm</groupId> <artifactId>htmx.org</artifactId> <version>2.0.2</version> </dependency> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-docker-compose</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <profiles> <profile>local</profile> </profiles> </configuration> </plugin> </plugins> </build> </project> ``` - **部署專案**: {:width 300} - **部署專案-log**: {:width 300} - ## 整合 Swagger - Bootify 內建 Swagger UI 支援,開發者可快速測試 API 接口,查看生成的文件,確認接口是否正確運行。 - **測試結果-首頁**: {:width 300, :height 123} - http://localhost:8080 - **測試結果-Swagger**: {:width 300} - http://localhost:8080/swagger-ui/index.html - ## 分享專案架構 - 透過 Bootify,可以輕鬆地將已建置完成的專案分享給他人 - 每個分享的專案會生成一個唯一的連結,可以選擇設置專案為私密或公開 - 在私密模式下,只有收到連結的使用者才能下載並檢視專案 - 這使得與團隊成員或客戶共享專案原始碼與架構更為簡便且安全 - 藉由分享連結,團隊成員可以快速地在自己的開發環境中複製並運行該專案,這大大提升了協作效率,尤其是當需要與多個開發者共同作業時 - {:width 300} - https://bootify.io/app/WA53UDGLOFK5 - 用 private 訪問可以下載分享的初始模版,包含 Schema (要小心分享權限) - **使用分享連結取得專案**: {:width 300} - initial version of product by bootify: https://bootify.io/app/WA53UDGLOFK5 - ## 總結 - Bootify 是一個工具,可快速生成 Spring Boot 專案架構,支援實體類、資料庫、UI 等配置 - 使用 Bootify 設置專案流程包括選擇專案模板、設定實體類與資料庫連線 - 支援 UI 配置,整合 Thymeleaf 與 Bootstrap,快速生成前端頁面 - 提供開發環境與部署設定,並支援 Maven 專案配置與 Intellij 匯入 - 內建 Swagger UI,用於快速測試 API 並查看文 - ## 延伸閱讀 - [[TPI/TPIU/Role Based Access Control (RBAC) 規劃]]: https://hackmd.io/@VxulnppPQHuOEDANOU92EQ/SymfrcyRA/https%3A%2F%2Fhackmd.io%2F%40VxulnppPQHuOEDANOU92EQ%2FSkG3HqyAC - ## 外部連結 - [[Bootify]] 官網: https://bootify.io - [[TPI/TPIU/Role Based Access Control (RBAC) 規劃]] ACL schema by H2.sql: https://gist.github.com/wanyutang/12af70ac910326412b8806cfa81784e4 - [[Winny Post]] 草稿筆記: https://hackmd.io/@VxulnppPQHuOEDANOU92EQ/SymfrcyRA/%2FJM1HwEc-Q9-G7c5179xhlw - ## 註腳 [^1]: SQL Schema 參考 [[TPI/TPIU/Role Based Access Control (RBAC) 規劃]][↗](https://hackmd.io/@VxulnppPQHuOEDANOU92EQ/SymfrcyRA/https%3A%2F%2Fhackmd.io%2F%40VxulnppPQHuOEDANOU92EQ%2FSkG3HqyAC) 案例 ## 轉載清單 - https://www.tpisoftware.com/tpu/articleDetails/3126?isPin=false - https://hackmd.io/@VxulnppPQHuOEDANOU92EQ/SymfrcyRA/%2FJM1HwEc-Q9-G7c5179xhlw
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up