java - Spring Boot Validation Set Parameter Name Provider -
i had validator bean used reflectionparameternameprovider
return correct reflected variables names e.g. methodname.myvarname
oppose methodname.arg0
@bean public validator validator() { final validatorfactory validatorfactory = validation.bydefaultprovider() .configure() .parameternameprovider(new reflectionparameternameprovider()) .buildvalidatorfactory(); return validatorfactory.getvalidator();
this worked correctly not autowire
beans in custom validator. enable beans autowire in constraintvalidator
must use.
@bean public validator validator() { return new localvalidatorfactorybean(); }
however cannot use reflectionparameternameprovider
.
question
how use localvalidatorfactorybean
reflectionparameternameprovider
?
spring's localvalidatorfactorybean
should include defaultparameternamediscoverer
in turn should rely on standardreflectionparameternamediscoverer
. not working you? on java 8? standardreflectionparameternamediscoverer
should pretty similar reflectionparameternameprovider
Comments
Post a Comment