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


source to share





All Articles