Reputation: 4282
@Size(message = "coming from messages.properties")
private String name;
How a message can be pulled from messages.properties in Spring Boot?
Upvotes: 0
Views: 243
Reputation: 52516
It works by implements of interface org.springframework.context.MessageSource
, these are:
org.springframework.context.support.ResourceBundleMessageSource
or
org.springframework.context.support.ReloadableResourceBundleMessageSource
You can attach Spring Framework's source code, place break points, then debug to see how it works under the hood.
Hibernate validators get message like almost other Java application. Spring Framework processed it before it called by Hibernate validators.
Upvotes: 0
Reputation: 5703
hibernate default search message key value in ValidationMessages.properties
file so add ValidationMessages.properties
in your resource path
Add you message key value in ValidationMessages.properties
e.g->
coming.from.messages.properties=coming from messages.properties
and in your class validation:
@Size(message = "coming.from.messages.properties")
private String name;
Upvotes: 1