java - How to customize the locale for javax validation -


i've 1 class in java i'm validating using javax.validation following code:

    validatorfactory validatorfactory = validation.builddefaultvalidatorfactory();     validator validator = validatorfactory.getvalidator();     set<constraintviolation<applicationrequest>> validationerrors = validator.validate(request);      (constraintviolation<myobject> valerrors : validationerrors) {         errors.add(valerrors.getpropertypath() + " " + valerrors.getmessage() + ". ");     } 

now, if execute in spanish server, error messages shown in spanish. however, when execute in testing server (which installed in english enviroment), messages shown in english. how tell javax validation use locale spanish language. possible?

when starting application can set default locale: how set default locale jvm?

if using application server @ docs how - there configuration that, instance jboss need add -duser.language=en java_opts section of run.conf.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -