logback.xml
日誌配置application.yml
攔截器配置新增 include-path
攔截路徑配置UploadInterceptor
文件上傳全局攔截器DownloadInterceptor
文件下載全局攔截器DownloadHandler
DefaultDownloadHandler
文件下載回調自定義處理器config/WebMvcConfig
--> core/SpringBootPlusWebMvcConfig
ImageController
--> ResouceController
,請求路徑 /api/resource
SysUser
CRUD../
非法路徑參數pom.xml
使用 spring-boot-starter-validation
替換 hibernate-validator
依賴-- ---------------------------- -- Table structure for sys_user -- ---------------------------- drop table if exists `sys_user`; create table sys_user( id bigint not null comment '主鍵', name varchar(20) null comment '用戶名稱', account varchar(20) not null comment '帳號', pwd varchar(20) not null comment '密碼', remark varchar(200) null comment '備註', create_time timestamp default CURRENT_TIMESTAMP null comment '建立時間', update_time timestamp null comment '修改時間', primary key (`id`), constraint sys_user_account_uindex unique (account) ) comment '系統用戶'; -- ---------------------------- -- Records of sys_user -- ---------------------------- INSERT INTO sys_user (id, name, account, pwd, remark, create_time, update_time) VALUES (1, 'Administrator', 'admin', '123456', 'Administrator Account', '2019-08-26 00:52:01', null);
修改數據庫信息html
修改組件名稱/做者/數據庫表名稱/主鍵idjava
/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
/** * spring-boot-plus代碼生成器入口類 * @author geekidea * @date 2018-11-08 */ public class CodeGenerator { private static final String USER_NAME = "root"; private static final String PASSWORD = "root"; private static final String DRIVER_NAME = "com.mysql.jdbc.Driver"; private static final String DRIVER_URL = "jdbc:mysql://localhost:3306/spring_boot_plus?useUnicode=true&characterEncoding=UTF-8&useSSL=false"; // CODE... // ############################ 配置部分 start ############################ // 模塊名稱 private static final String MODULE_NAME = "system"; // 做者 private static final String AUTHOR = "geekidea"; // 生成的表名稱 private static final String TABLE_NAME = "sys_user"; // 主鍵數據庫列名稱 private static final String PK_ID_COLUMN_NAME = "id"; // 代碼生成策略 true:All/false:SIMPLE private static final boolean GENERATOR_STRATEGY = true; // 分頁列表查詢是否排序 true:有排序參數/false:無 private static final boolean PAGE_LIST_ORDER = false; // ############################ 配置部分 end ############################ public static void main(String[] args) { // Run... } }
項目入口類mysql
/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
/** * spring-boot-plus 項目啓動入口 * @author geekidea * @since 2018-11-08 */ @EnableAsync @EnableScheduling @EnableTransactionManagement @EnableConfigurationProperties @EnableAdminServer @MapperScan({"io.geekidea.springbootplus.**.mapper"}) @SpringBootApplication public class SpringBootPlusApplication { public static void main(String[] args) { // 啓動spring-boot-plus ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args); // 打印項目信息 PrintApplicationInfo.print(context); } }
http://127.0.0.1:8888/swagger-ui.htmlgit