Created
November 22, 2017 08:05
-
-
Save suhanlee/dab4c04725279ac2582975d7562baa88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Size(min = 5, max = 12, message = "{category.name.size}") | |
| private String name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| category.name.size = "The category must be {min} to {max} characters in length. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment