Search in sources :

Example 11 with ReloadableResourceBundleMessageSource

use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project lavagna by digitalfondue.

the class PersistenceAndServiceConfig method messageSource.

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setBasename("classpath:/io/lavagna/i18n/messages");
    source.setUseCodeAsDefaultMessage(true);
    source.setFallbackToSystemLocale(false);
    return source;
}
Also used : ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 12 with ReloadableResourceBundleMessageSource

use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project Flare-event-calendar by PollubCafe.

the class MessagesConfig method messageSource.

@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/messages");
    return messageSource;
}
Also used : ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Example 13 with ReloadableResourceBundleMessageSource

use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project mica2 by obiba.

the class LocaleConfiguration method messageSource.

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/i18n/messages");
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(propertyResolver.getProperty("cacheSeconds", Integer.class, 1));
    return messageSource;
}
Also used : ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 14 with ReloadableResourceBundleMessageSource

use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project tutorials by eugenp.

the class MvcConfig method messageSource.

@Bean
public MessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:messages");
    messageSource.setUseCodeAsDefaultMessage(true);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(0);
    return messageSource;
}
Also used : ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 15 with ReloadableResourceBundleMessageSource

use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project irida by phac-nml.

the class IridaApiServicesConfig method messageSource.

@Bean
public MessageSource messageSource() {
    logger.info("Configuring ReloadableResourceBundleMessageSource.");
    final Properties properties = new Properties();
    properties.setProperty("help.page.title", helpPageTitle);
    properties.setProperty("help.page.url", helpPageUrl);
    properties.setProperty("help.contact.email", helpEmail);
    properties.setProperty("irida.version", iridaVersion);
    final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setBasenames(RESOURCE_LOCATIONS);
    source.setFallbackToSystemLocale(false);
    source.setDefaultEncoding(DEFAULT_ENCODING);
    source.setCommonMessages(properties);
    // Don't cache at all if in development
    if (!env.acceptsProfiles("prod")) {
        source.setCacheSeconds(0);
    }
    return source;
}
Also used : ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Properties(java.util.Properties) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Aggregations

ReloadableResourceBundleMessageSource (org.springframework.context.support.ReloadableResourceBundleMessageSource)15 Bean (org.springframework.context.annotation.Bean)10 Test (org.junit.Test)3 MessageSourceAccessor (org.springframework.context.support.MessageSourceAccessor)3 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)3 Properties (java.util.Properties)2 InputStream (java.io.InputStream)1 DateTime (org.joda.time.DateTime)1 Duration (org.joda.time.Duration)1 Before (org.junit.Before)1 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)1