Java Code Examples for org.springframework.context.support.ReloadableResourceBundleMessageSource#setCacheSeconds()

The following examples show how to use org.springframework.context.support.ReloadableResourceBundleMessageSource#setCacheSeconds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernateValidateConfig.java    From spring-boot-api-project-seed with Apache License 2.0 5 votes vote down vote up
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
    reloadableResourceBundleMessageSource.setBasenames("classpath:message/ValidationMessages");
    reloadableResourceBundleMessageSource.setUseCodeAsDefaultMessage(true);
    reloadableResourceBundleMessageSource.setDefaultEncoding("UTF-8");
    reloadableResourceBundleMessageSource.setCacheSeconds(60);
    return reloadableResourceBundleMessageSource;
}
 
Example 2
Source File: ErrorHandleConfiguration.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Bean(name=ExceptionMessageAccessor.BEAN_EXCEPTION_MESSAGE)
public MessageSource exceptionMessageSource(@Autowired BootJFishConfig bootJFishConfig){
	ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource();
	ms.setCacheSeconds(bootJFishConfig.getMessageSource().getCacheSeconds());
	ms.setBasenames("classpath:messages/exception-messages", 
			"classpath:messages/default-exception-messages", 
			"org/hibernate/validator/ValidationMessages");
	return ms;
}
 
Example 3
Source File: SpringMessageSourceHelperTest.java    From trimou with Apache License 2.0 5 votes vote down vote up
private static MessageSource initMessageSource() {
    final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setCacheSeconds(5);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setFallbackToSystemLocale(true);
    messageSource.setUseCodeAsDefaultMessage(false);
    messageSource.setBasename("classpath:messages");
    return messageSource;
}