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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -