Example usage for org.springframework.context.support ReloadableResourceBundleMessageSource setCacheSeconds

List of usage examples for org.springframework.context.support ReloadableResourceBundleMessageSource setCacheSeconds

Introduction

In this page you can find the example usage for org.springframework.context.support ReloadableResourceBundleMessageSource setCacheSeconds.

Prototype

public void setCacheSeconds(int cacheSeconds) 

Source Link

Document

Set the number of seconds to cache loaded properties files.

Usage

From source file:org.osiam.configuration.WebApplicationConfig.java

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("file:" + osiamHome + "/i18n/login");
    messageSource.setDefaultEncoding("utf-8");
    messageSource.setCacheSeconds(-1);
    return messageSource;
}

From source file:magoffin.matt.sobriquet.web.config.MvcConfig.java

@Bean(name = "messageSource")
public MessageSource getMessageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasename("/WEB-INF/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setCacheSeconds(i18nCacheSecs);
    return resource;
}

From source file:org.fuzzydb.samples.mvc.config.WebMvcConfig.java

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("/WEB-INF/messages/messages");
    messageSource.setCacheSeconds(5);
    return messageSource;
}

From source file:com.surveypanel.form.InMemoryFormFactory.java

@Override
public MessageSource getMessageSource(long surveyId) {
    ReloadableResourceBundleMessageSource msg = new ReloadableResourceBundleMessageSource();
    msg.setBasename("messages");
    msg.setDefaultEncoding("UTF-8");
    msg.setCacheSeconds(10);
    msg.setUseCodeAsDefaultMessage(true);
    return msg;//from  w ww .j  a  va 2 s.  c  om
}

From source file:com.devnexus.ting.config.WebConfig.java

@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:messages");
    messageSource.setDefaultEncoding("utf-8");
    messageSource.setCacheSeconds(0);
    return messageSource;
}

From source file:com.isalnikov.config.AppConfigTest.java

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setUseCodeAsDefaultMessage(true);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setBasenames("classpath:message");
    messageSource.setCacheSeconds(5);
    //messageSource.setFallbackToSystemLocale(false);// ???
    return messageSource;
}

From source file:com.utils.BundleMessageReader.java

public String getMessage(String key) {
    Locale locale = LocaleContextHolder.getLocale();

    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames("classpath:messages");
    messageSource.setUseCodeAsDefaultMessage(true);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(0);

    return messageSource.getMessage(key, new Object[0], locale);
}

From source file:org.unidle.config.I18NConfiguration.java

@Bean
public MessageSource messageSource() {
    final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();

    messageSource.setDefaultEncoding(messageSourceEncoding);
    messageSource.setBasename(messageSourceBaseName);
    messageSource.setCacheSeconds(messageSourceCacheSeconds);

    return messageSource;
}

From source file:be.bittich.quote.config.SpringCoreConfig.java

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames("classpath:i18n/messages");
    messageSource.setUseCodeAsDefaultMessage(true);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(0);
    return messageSource;
}

From source file:de.blizzy.documentr.context.ContextConfig.java

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setFallbackToSystemLocale(false);
    messageSource.setCacheSeconds(10);
    messageSource.setBasenames(new String[] { "classpath:documentr_messages", "classpath:ValidationMessages" //$NON-NLS-1$ //$NON-NLS-2$
    });/*  w  ww. j a v a  2  s .  c o m*/
    return messageSource;
}