0
我的應用程序是完全配置的帶有thymeleaf模板引擎的spring-boot應用程序。 I18n也配置好了,所以我可以在我的模板中使用它。這裏是配置使用:在使用JSR-303驗證表單時使用I18n消息
spring.messages.basename=i18n/messages
雖然手動驗證領域的I18n也很好地工作:
BindingResult result;
result.rejectValue("field", "some.i18n.code");
但是,一旦我要實現一些自定義的ConstraintValidator
對象,並使用message
場 - 無的I18n參與其中,我接收簡單代碼作爲迴應而不是消息。即
{some.i18n.code}
我試過this solution - 沒有結果。 This on - 同樣的結果。
我錯過了什麼?