Spring validation annotations using parameter message

I am trying to use custom post annotations in spring / hibernate validation. What I want to do is internationalization support allowing parameter passing.

For example, here is a field in the java class:

@NotEmpty (message = "{error.required}")
public String name;

      

ValidationMessages.properties has the following:

error.required = {0} is a required field

      

So I am looking for a way to pass the field name to this post using the post annotation in the java class. Is it possible?

EDIT: Similar to this question to you: JSR 303 Bean Validation in Spring

+3
java spring-validator hibernate-validator bean-validation


source to share


No one has answered this question yet

See similar questions:

3
JSR 303 Bean Validation in Spring

or similar:

1873
What's the difference between @Component, @Repository and @Service annotations in Spring?
633
Difference between <context: annotation-config> vs <context: component-scan>
74
Difference between @Valid and @Validated values โ€‹โ€‹in Spring
43
JSR 303 Bean Validation + Javascript Client Side Validation
nine
Spring 3.1 auto-handling not working inside validator check
8
Is there a standard way to include JSR 303 Bean Validation using annotated method arguments
8
Spring MVC with Hibernate validator. How do I check a property by group?
3
Spring MVC + Hibernate validator: how can I override / internationalize the default error messages?
1
JSR-303 validation ignored when custom validator is annotated with @Component
1
JSR-303 Spring Properties Annotation



All Articles
Loading...
X
Show
Funny
Dev
Pics