Customize spring boot validation message from database -


i using spring validation validate rest controller input, appreciate if 1 can tell me there possibility of throwing custom message in case of exception , custom message should come database rather properties file.

you can achieve setting custom validation message source on spring's localvalidatorfactorybean.

your message source needs implement messagesource interface , read messages database.

reference:

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/validation/beanvalidation/localvalidatorfactorybean.html#setvalidationmessagesource-org.springframework.context.messagesource-

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/messagesource.html


Comments

Popular posts from this blog

javascript - Why Selenium can't find an element that is graphically visible -

java - How to compare two classes -

mysql - Gateway Timeout Error on Insert 70000 record using Hibernate in Java -