Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AppConfig extends WebMvcConfigurerAdapter{
- @Bean
- public MessageSource messageSource() {
- ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource();
- bean.setBasename("classpath:messages");
- bean.setDefaultEncoding("UTF-8");
- return bean;
- }
- @Bean
- public LocalValidatorFactoryBean validator() {
- LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
- bean.setValidationMessageSource(messageSource());
- return bean;
- }
- @Override
- public Validator getValidator() {
- return validator();
- }
- }
Add Comment
Please, Sign In to add comment