Created
July 27, 2016 06:19
-
-
Save arahansa/98e86e2ac6e4c57040ddfb3642dc8faf to your computer and use it in GitHub Desktop.
This file contains 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
@Bean | |
/*@Profile({"default", "test"})*/ | |
public MessageSource messageSource() { | |
return messageSourcePrivate(seconds); | |
} | |
private ResourceBundleMessageSource messageSourcePrivate(int seconds){ | |
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); | |
messageSource.setBasenames("i18n/messages", "i18n/category" , "i18n/main", "i18n/intro", "i18n/customer"); | |
messageSource.setUseCodeAsDefaultMessage(true); | |
messageSource.setDefaultEncoding("UTF-8"); | |
messageSource.setCacheSeconds(seconds); | |
return messageSource; | |
} |
This file contains 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
@Autowired | |
private MessageSource messageSource; | |
/** | |
* 한/영 별로 달라지는 메시지 소스 테스트 | |
*/ | |
@Test | |
public void messageSourceTest(){ | |
final String message = messageSource.getMessage("label.user.password", null, Locale.KOREA); | |
log.info("message : {} ", message); | |
assertEquals(message, "Password"); | |
final String helloMessage = messageSource.getMessage("test.message", null, Locale.KOREA); | |
log.info("hello Message : {} ", helloMessage); | |
assertEquals(helloMessage, "안녕하세요"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment