Spring boot form validation @ Validated
message internationalization resource files must be placed in resources/ValidationMessages.properties
by default.
now I want to put the resource file in resources/i18n/validation/message.properties
. How can I modify it?
found some information on the Internet and tried the following code, but it still didn"t work
@Configuration
public class ValidationConfig {
@Bean
public Validator getValidator() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("i18n/validation/message.properties");
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setValidationMessageSource(messageSource);
return validator;
}
}