List of usage examples for org.springframework.context.support ReloadableResourceBundleMessageSource setCacheSeconds
public void setCacheSeconds(int cacheSeconds)
From source file:br.com.joaops.awc.configuration.WebConfig.java
private MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setDefaultEncoding("UTF-8"); messageSource.setBasenames("classpath:/org/springframework/security/messages", "classpath:/org/hibernate/validator/ValidationMessages"); messageSource.setCacheSeconds(0); messageSource.setFallbackToSystemLocale(Boolean.TRUE); return messageSource; }
From source file:com.springsource.greenhouse.config.WebConfig.java
public Validator getValidator() { LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean(); ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("/WEB-INF/messages/validation"); if (environment.acceptsProfiles("embedded")) { messageSource.setCacheSeconds(0); }/* w ww .ja v a 2 s. c o m*/ factory.setValidationMessageSource(messageSource); return factory; }
From source file:se.kth.csc.config.WebMvcConfig.java
@Bean(name = "messageSource") public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); // Configure the location of messages messageSource.setBasename(MESSAGE_SOURCE); // Cache messages for a while, but make sure that they can be edited at run-time messageSource.setCacheSeconds(5); log.info("Creating message source reading from {} that caches for 5 seconds", MESSAGE_SOURCE); return messageSource; }
From source file:com.acc.storefront.web.theme.StorefrontResourceBundleSource.java
protected AbstractMessageSource createMessageSource(final String basename) { final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename(basename); messageSource.setCacheSeconds(getCacheSeconds()); messageSource.setResourceLoader(getResourceLoader()); messageSource.setFallbackToSystemLocale(fallbackToSystemLocale); messageSource.setDefaultEncoding(getDefaultEncoding()); return messageSource; }
From source file:br.com.joaops.smt.configuration.WebConfig.java
private MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setDefaultEncoding("UTF-8"); messageSource.setBasenames("classpath:/org/springframework/security/messages", "classpath:/org/hibernate/validator/ValidationMessages", "classpath:/br/com/joaops/smt/i18n/messages"); messageSource.setCacheSeconds(0); //Escolher um valor do cache na hora da implantao. Para testes deixar como '0' zero messageSource.setFallbackToSystemLocale(Boolean.TRUE); return messageSource; }
From source file:com.redhat.rhtracking.config.WebConfig.java
@Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames("classpath:messages/messages", "classpath:messages/validation"); // if true, the key of the message will be displayed if the key is not // found, instead of throwing a NoSuchMessageException messageSource.setUseCodeAsDefaultMessage(true); messageSource.setDefaultEncoding("UTF-8"); // # -1 : never reload, 0 always reload messageSource.setCacheSeconds(0); return messageSource; }
From source file:com.aspose.showcase.qrcodegen.web.config.WebAppConfig.java
@Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames("classpath:messages/messages", "classpath:messages/validation"); // if true, the key of the message will be displayed if the key is not // found, instead of throwing a NoSuchMessageException messageSource.setUseCodeAsDefaultMessage(true); messageSource.setDefaultEncoding("UTF-8"); // # -1 : never reload, 0 always reload messageSource.setCacheSeconds(0); return messageSource; }
From source file:com.MockGatewayApplication.java
@Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames("classpath:messages"); // if true, the key of the message will be displayed if the key is not // found, instead of throwing a NoSuchMessageException messageSource.setUseCodeAsDefaultMessage(true); messageSource.setDefaultEncoding("UTF-8"); // # -1 : never reload, 0 always reload messageSource.setCacheSeconds(0); return messageSource; }
From source file:org.fenixedu.bennu.spring.BennuSpringConfiguration.java
@Bean public MessageSource messageSource(ApplicationContext context) { ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource(); source.setDefaultEncoding("UTF-8"); final String[] baseNames = getBaseNames(context).toArray(new String[0]); logger.debug("Adding basenames by @BennuSpringModule configuration: {}", Arrays.toString(baseNames)); source.setBasenames(baseNames);/*from ww w .j ava 2s .co m*/ // Reload resources only when in development mode source.setCacheSeconds(bennuCoreConfiguration().developmentMode() ? 1 : -1); // Allow using the message code as the message itself, as it is preferable // to have an interface without a proper label, than one that doesn't work at all source.setUseCodeAsDefaultMessage(true); return source; }
From source file:at.porscheinformatik.common.spring.web.extended.config.SpringWebExtendedConfigurerConfig.java
public void configureMessageSource(ReloadableResourceBundleMessageSource messageSource) { ApplicationConfiguration appConfig = appConfig(); MessageSourceConfig config = new DefaultMessageSourceConfig(); config.addBaseName("WEB-INF/messages/Messages"); config.setCacheSeconds(appConfig.isOptimizeResources() ? -1 : DEFAULT_REFRESH_INTERVALL); config.setDefaultEncoding("UTF-8"); configurer.configureMessageSource(config); messageSource.setCacheSeconds(config.getCacheSeconds() != null ? config.getCacheSeconds() : -1); if (!CollectionUtils.isEmpty(config.getBaseNames())) { messageSource.setBasenames(config.getBaseNames().toArray(new String[config.getBaseNames().size()])); }/*from www .ja v a 2s . c o m*/ messageSource.setDefaultEncoding(config.getDefaultEncoding()); }