Spring Boot回應代碼訊息多國語言(i18n)範例。
網頁
2020/6/30
2020/6/29
2020/6/28
Spring Boot MessageSource 自動配置
Spring Boot自動配置了MessageSource
做i18n多國語言訊息,所以若無特殊需求不用自己配置MessageSource
的bean。
2020/6/26
2020/6/25
2020/6/22
2020/6/21
2020/6/20
Effective Java 3e - Item 4: Enforce noninstantiability with a private constructor 筆記
Effective Java 3e - Item 4: Enforce noninstantiability with a private constructor 使用private建構式使無法實例化。
2020/6/19
Java final 效能較好? add final to improve performance?
幾年前有個同事寫程式會加一堆final
,當時我只知道final
可避免變數值被修改,但不曉得為什麼他幾乎在每個地方都加,他的回答是效能較好,well...。
Java Functional Interface是什麼?
「A functional interface has exactly one abstract method」,也就是「Functional Interface是只有一個抽象方法的Interface」。
2020/6/18
Java OptionalInt 使用時機
讀了「Effective Java 3e - Item 55: Return optionals judiciously」後知道不要用Optional
去包primitive type的boxed type類別,也就是不要用Optional<Integer>
,應改用OptionalInt
。
Effective Java 3e - Item 55: Return optionals judiciously 筆記
Effective Java 3e - Item55: Return optionals judiciously 回傳Optional。
Effective Java 3e - Item 54: Return empty collections or arrays, not nulls 筆記
Effective Java 3e - Item 54: Return empty collections or arrays, not nulls 返回空集合或陣列,不要返回null。
Effective Java 3e - Item 51: Design method signatures carefully 筆記
Effective Java 3e - Item51: Design method signatures carefully 設計方法簽章。
2020/6/17
為什麼網際網路不用Socket直連而要用HTTP協議
最近實作Socket Client與Socket Server互連的範例後,腦中浮現出一個問題,既然Socket連線這麼簡單為什麼網路不用Socket構成而用HTTP呢?
Effective Java 3e - Item 50: Make defensive copies when needed 筆記
Effective Java 3e - Item 50: Make defensive copies when needed 防禦性複製。
2020/6/15
2020/6/14
Effective Java 3e - Item 49: Check parameters for validity 筆記
Effective Java 3e - Item 49: Check parameters for validity 檢查參數的有效性 筆記。
2020/6/13
Spring Web 處理存取資料庫例外錯誤 handle database access exception
在Spring Web專案中,通常在DAO或Repository層存取資料庫,而存取資料庫時拋出例外錯誤該在哪處理?
2020/6/10
2020/6/8
2020/6/6
2020/6/5
Use milliseconds to record date time
In my current working project, our team uses milliseconds to record the moment of DML. The problem is using milliseconds is not intuitive for developers to read. They cannot tell the time through the long number. I have to copy the long number and use online converter to translate milliseconds to readable date time information when debugging, such a pain.
I asked a member about the reason, he told me maybe they wanted to record time directly by Java System.currentTimeMillis()
.
I would use TIMESTAMP
instead.
2020/6/4
JWK (JSON Web Key) 是什麼?
JSON Web Key,簡稱JWK,是以JSON物件表示,用來驗證JWT的signature(簽章)的公開金鑰(cryptographic key)。
2020/6/2
2020/6/1
Spring AOP get method advice annotation and parameters
在Spring AOP透過從annotation advice取得方法的annotation。