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

ios - Is 'init' forbidden as *part* of a variable name? -

angular - Angular2 Router: Cannot find primary outlet to load 'HomeComponent' -

qt - Microsoft FTP Service 451 The parameter is incorrect -