I am working on a spring boot application to build a rest service. I have implemented a spring validator for validating request.
Now, I want to fetch error messages from properties file. But it didn't work.I found from validator API that "This interface is totally divorced from any infrastructure or context;"
I have tried below options. But, always getting env as null
@Inject
private Environment env;
@Autowire
private Environment env;
@Resource
private Environment env;
Is there any work around?
EDIT: I'm using below code:
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.setValidator(new RequestValidator());
}
Aucun commentaire:
Enregistrer un commentaire