原创 Intellij 構建基於gradle的SpringBoot項目

1.在IDEA選擇 File -> New - > Project -> Spring Initializr -> 點擊Next 2.填寫組織信息,工程名稱,工程類型選擇Gradle Project,打包類型選擇Jar ,點擊N

原创 Thymeleaf 變量、運算符、表達式

變量 分類 實例 文本 one text,Another one!,… 數字 0 , 34 , 3.0 , 12.3 ,… 真假 true , false 文字符號 one , sometext , ma

原创 SpringBoot 集成Spring AOP

第一步:創建SpringBoot項目,導入Maven依賴 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-bo

原创 SpringBoot 統一頁面異常處理

相關博客:SpringBoot 統一異常處理 第一步:創建項目 添加Maven依賴: <dependency> <groupId>org.springframework.boot</groupId> <artifa

原创 Thymeleaf 模板佈局

概述 模板模塊導入 首先定義一個 /resources/templates/footer.html 文件: <!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-st

原创 SpringBoot靜態資源和WebJars

SpringBoot靜態資源目錄 默認情況下,Spring提供瞭如下幾個靜態資源目錄: 目錄 說明 /static classpath:/static/ /public classpath:/public/

原创 Thymeleaf 語法基礎

引入 Thymeleaf 修改 html 標籤用於引入 thymeleaf 引擎,這樣纔可以在其他標籤裏使用 th:* 語法,這是下面語法的前提。 <html xmlns="http://www.w3.org/1999/xhtml

原创 Thymeleaf 內置對象和內置方法

示例 第一步:創建demo3.html <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta c

原创 SpringBoot 自定義註解

參考博客:基於反射自定義註解 代碼下載地址:代碼 基於AOP實現 第一步:創建SpringBoot項目,添加依賴 <dependency> <groupId>org.springframework.boot</groupI

原创 SpringBoot 自定義過濾器

利用WebFilter註解實現 第一步:創建SpringBoot項目,添加依賴 <dependency> <groupId>org.springframework.boot</groupId> <artifactI

原创 Mockito原理

Mockito簡介 在面向對象程序設計中,模擬對象(mock object)是以可控的方式模擬真實對象行爲的假的對象。比如:對象B依賴於對象A,但是A代碼還沒寫,是一個空類,空方法不能用,我們來mock一個假的A來完成測試。 在單

原创 Linux 目錄管理

目錄結構 目錄 說明 bin 存放二進制可執行文件(ls, cat, mkdir 等) boot 存放用於系統引導時使用的各種文件 dev 用於存放設備文件 etc 存放系統配置文件 home 存放

原创 SpringBoot 配置多數據源(MyBatis版)

第一步:創建SpringBoot項目 Maven依賴: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>te

原创 SpringBoot 集成Thymeleaf

Thymeleaf 簡介 什麼是 Thymeleaf Thymeleaf 是一個跟 Velocity、FreeMarker 類似的模板引擎,它可以完全替代 JSP 。相較與其他的模板引擎,它有如下三個極吸引人的特點 Thymel

原创 Mockito測試 示例

相關博客:Mockito原理 本博客相關代碼:代碼下載 步驟 整個測試過程非常有規律: 準備測試環境 通過MockMvc執行請求 3.1. 添加驗證斷言 3.2. 添加結果處理器 3.3. 得到MvcResult進行自定義斷言/