對不起,如果這個問題已經覆蓋了某個地方之前。如果它有請聯繫我,我還沒有找到一個滿意的答案。使javax驗證錯誤消息更具體
我一直在四處尋找嘗試找到一種方法來讓我的javax驗證提供的錯誤消息更具體。
我@Min註釋我目前擁有的消息在ValidationMessages.properties文件中指定:
javax.validation.constraints.Min.message=The value of this variable must be less than {value}.
這打印出如所預期的
The value of this variable must be less than 1
我想什麼有消息還包括未通過驗證的變量(和類)的名稱以及失敗的變量的值。所以更喜歡。
The value of class.variable was 0 but not must be less than 1
任何幫助將不勝感激。
Klee