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.davidmendoza.fileUpload.config.WebConfig.java

/**
 * Messages to support internationalization/localization.
 * @return /*from  www .j  av  a 2s.  c o m*/
 */
@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:messages");
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(0);
    return messageSource;
}

From source file:org.davidmendoza.fileUpload.config.WebConfig.java

@Override
public Validator getValidator() {
    LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:messages");
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(0);
    factory.setValidationMessageSource(messageSource);
    return factory;
}

From source file:br.com.semanticwot.cd.conf.AppWebConfiguration.java

@Bean
public MessageSource messageSource() { // Mtodo para disponibilizar arquivos de mensagens
    ReloadableResourceBundleMessageSource bundle = new ReloadableResourceBundleMessageSource();
    bundle.setBasename("/WEB-INF/messages/messages");
    bundle.setDefaultEncoding("UTF-8");
    bundle.setCacheSeconds(1);
    return bundle;
}

From source file:com.isalnikov.config.web.WebConfig.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:it.f2informatica.webapp.WebApplicationConfig.java

@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames(basenames());
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(1);
    messageSource.setFallbackToSystemLocale(false);
    return messageSource;
}

From source file:org.lightadmin.core.config.context.LightAdminContextConfiguration.java

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

From source file:com.devnexus.ting.web.config.PersistenceConfig.java

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

From source file:net.sf.sze.config.WebMvcConfig.java

/**
 * Initiates the message resolver.//ww  w . j  a  v  a 2s  .c  o m
 *
 * @return a message source.
 */
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames(MESSAGE_SOURCE, APP_MESSAGE_SOURCE, HELP_MESSAGE_SOURCE, MESSAGE_SOURCE_OVAL);
    messageSource.setCacheSeconds(MESSAGE_CACHE);
    messageSource.setFallbackToSystemLocale(false);
    // Make sure Apostrophs must always be doubled..
    messageSource.setAlwaysUseMessageFormat(true);
    // This persister doubles Apostoph
    messageSource.setPropertiesPersister(
            new RecursivePropertiesPersister(new ApostropheEscapingPropertiesPersister()));

    final Class<?>[] classes = URL.class.getDeclaredClasses();
    final UrlDefinitionsToMessages urlDefinitions = new UrlDefinitionsToMessages(classes);
    urlDefinitions.addParamGroupAsMessages();
    urlDefinitions.addParamsAsMessages();
    urlDefinitions.addUrlsAsMessagesWithNamedParameters();
    Properties staticMessages = urlDefinitions.getMessages();
    final EntityPropertiesToMessages epm = new EntityPropertiesToMessages("net.sf.sze.model");
    staticMessages.putAll(epm.getProperties());
    final String version = buildNr.replace("SNAPSHOT", Long.toString(System.currentTimeMillis()));
    staticMessages.put("app.version", version);
    messageSource.setCommonMessages(staticMessages);
    return messageSource;
}

From source file:com.activiti.conf.DispatcherServletConfiguration.java

@Bean
public MessageSource messageSource() {
    log.debug("Loading MessageSources");
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("/WEB-INF/messages/messages");
    messageSource.setDefaultEncoding(CharEncoding.UTF_8);
    if ("true".equals(env.getProperty("message.reloading.enabled"))) {
        messageSource.setCacheSeconds(1);
    }/*from   ww  w  .  j ava2 s .  c  o  m*/
    return messageSource;
}

From source file:com.springsource.greenhouse.config.WebConfig.java

/**
 * Messages to support internationalization/localization.
 *///from   w w  w .  jav  a2 s  .  c o m
@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("/WEB-INF/messages/messages");
    if (environment.acceptsProfiles("embedded")) {
        messageSource.setCacheSeconds(0);
    }
    return messageSource;
}