此範本需要MySQL
資料庫及JDK21
環境
支援lombok plugin
可選擇以下兩種方式,擇一使用。
- 使用
docker-compose.yml
建立簡易環境。 - 安裝
MySQL
資料庫,並使用product_schema.sql
建立Table
基本執行指令:
mvn spring-boot:run
後面可帶參數決定不同環境變數執行,例如
mvn spring-boot:run -Ptest
會根據pom.xml
的<profiles>
內容引入相對應變數
預設情形之下,在網址打上
即可看到結果
在generatorConfig.xml
內部添加table設定,添加的方式在generatorConfig.xml
內的註解有說明。
執行maven generator:
mvn mybatis-generator:generate
加上-e可查看generator過程:
mvn mybatis-generator:generate -e
執行後根據generator.properties
配置的參數產生至對應的位置。