當前位置: 首頁>>代碼示例>>Java>>正文


Java ReloadableResourceBundleMessageSource.setCacheSeconds方法代碼示例

本文整理匯總了Java中org.springframework.context.support.ReloadableResourceBundleMessageSource.setCacheSeconds方法的典型用法代碼示例。如果您正苦於以下問題:Java ReloadableResourceBundleMessageSource.setCacheSeconds方法的具體用法?Java ReloadableResourceBundleMessageSource.setCacheSeconds怎麽用?Java ReloadableResourceBundleMessageSource.setCacheSeconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.context.support.ReloadableResourceBundleMessageSource的用法示例。


在下文中一共展示了ReloadableResourceBundleMessageSource.setCacheSeconds方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@PostConstruct
protected void initMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:messages/conversation");
    messageSource.setDefaultEncoding("utf-8");
    messageSource.setCacheSeconds(3600);

    if (externalResourceBundle != null) {
        ReloadableResourceBundleMessageSource external = new ReloadableResourceBundleMessageSource();
        external.setBasename(externalResourceBundle);
        external.setDefaultEncoding("utf-8");
        external.setCacheSeconds(500);
        external.setParentMessageSource(messageSource);

        this.messageSource = external;
    } else {
        this.messageSource = messageSource;
    }
}
 
開發者ID:redlink-gmbh,項目名稱:smarti,代碼行數:20,代碼來源:SpeakService.java

示例2: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean(name = "messageSource")
public MessageSource messageSource() {
    // MessageSource configuration for localized messages.
    final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();

    source.setBasenames("classpath:/i18n/messages", "classpath:ValidationMessages");
    source.setUseCodeAsDefaultMessage(true);
    source.setFallbackToSystemLocale(false);
    source.setDefaultEncoding(StandardCharsets.ISO_8859_1.name());

    if (runtimeEnvironmentUtil.isDevelopmentEnvironment()) {
        // Check for updates on every refresh, otherwise cache forever
        source.setCacheSeconds(1);
    }

    return source;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:18,代碼來源:LocalizationConfig.java

示例3: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean(name = "messageSource")
public MessageSource messageSource() {
	ReloadableResourceBundleMessageSource reloadMessage = new ReloadableResourceBundleMessageSource();
	reloadMessage.setBasename("classpath:/messages");
	reloadMessage.setDefaultEncoding("UTF-8");
	reloadMessage.setCacheSeconds(0);
	return reloadMessage;
}
 
開發者ID:grantharper,項目名稱:security-demo,代碼行數:9,代碼來源:WebConfiguration.java

示例4: configureMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
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()]));
    }

    messageSource.setDefaultEncoding(config.getDefaultEncoding());
}
 
開發者ID:furti,項目名稱:spring-web-extended,代碼行數:21,代碼來源:SpringWebExtendedConfigurerConfig.java

示例5: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource bundleMessageSource = new ReloadableResourceBundleMessageSource();
    bundleMessageSource.setBasename("classpath:i18n/messages");
    bundleMessageSource.setCacheSeconds(1800);
    bundleMessageSource.setDefaultEncoding("UTF-8");
    return bundleMessageSource;
}
 
開發者ID:WickedWitchWarsaw,項目名稱:ThymeleafSpringDemo,代碼行數:9,代碼來源:I18NConfig.java

示例6: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() { // Método para disponibilizar arquivos de mensagens
    ReloadableResourceBundleMessageSource bundle
            = new ReloadableResourceBundleMessageSource();
    bundle.setBasename("/WEB-INF/messages/messages");
    bundle.setDefaultEncoding("UTF-8");
    bundle.setCacheSeconds(1);
    return bundle;
}
 
開發者ID:nailtonvieira,項目名稱:pswot-cloud-java-spring-webapp,代碼行數:10,代碼來源:AppWebConfiguration.java

示例7: getMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
private static MessageSource getMessageSource()
{
	ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
	messageSource.setBasenames("classpath:/messages");
	messageSource.setUseCodeAsDefaultMessage(true);
	messageSource.setDefaultEncoding("UTF-8");
	messageSource.setCacheSeconds(0);
	return messageSource;
}
 
開發者ID:benetech,項目名稱:Secure-App-Generator,代碼行數:10,代碼來源:SecureAppGeneratorApplication.java

示例8: configureMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
	ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
	messageSource.setBasenames(MESSAGE_SOURCE, VERSION_SOURCE);
	messageSource.setCacheSeconds(5);
	return messageSource;
}
 
開發者ID:macielbombonato,項目名稱:apolo,代碼行數:8,代碼來源:WebMvcConfig.java

示例9: exceptionMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@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");
	return ms;
}
 
開發者ID:wayshall,項目名稱:onetwo,代碼行數:8,代碼來源:ErrorHandleConfiguration.java

示例10: getMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Gets the reloadable resource bundle message source.
 *
 * @return the reloadable resource bundle message source
 */
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
  logger.debug("Instantiated reloadableResourceBundleMessageSource");
  ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
  source.setBasename("/WEB-INF/messages");
  source.setCacheSeconds(1);
  source.setFallbackToSystemLocale(false);
  return source;
}
 
開發者ID:psi-probe,項目名稱:psi-probe,代碼行數:15,代碼來源:ProbeConfig.java

示例11: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
	ReloadableResourceBundleMessageSource bundle = new ReloadableResourceBundleMessageSource();
	bundle.setBasename("messages");
	bundle.setDefaultEncoding(TEMPLATE_RESOLVER_CHAR_ENCODING);
	bundle.setCacheSeconds(5);
	return bundle;
}
 
開發者ID:gsag,項目名稱:spring-mvc-seed,代碼行數:9,代碼來源:WebMvcConfiguration.java

示例12: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
	ReloadableResourceBundleMessageSource result = new ReloadableResourceBundleMessageSource();
	result.setBasename("/WEB-INF/messages");
	result.setDefaultEncoding("UTF-8");
	result.setCacheSeconds(1);
	
	return result;
}
 
開發者ID:flaviociaware,項目名稱:cwEnsaiosWeb,代碼行數:10,代碼來源:AppWebConfiguration.java

示例13: configureMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Configure message source.
 *
 * @return the message source
 */
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
	ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
	messageSource.setBasename(WebMvcConsts.MESSAGE_SOURCE.getValue());
	messageSource.setCacheSeconds(5);
	return messageSource;
}
 
開發者ID:techtrip,項目名稱:dynamicbeanloader,代碼行數:13,代碼來源:WebMvcConfig.java

示例14: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Resolves localized messages*.properties and application.properties files in the application to allow for internationalization. 
    * The messages*.properties files translate Roo generated messages which are part of the admin interface, the application.properties
    * resource bundle localizes all application specific messages such as entity names and menu items.
 */
public @Bean ReloadableResourceBundleMessageSource messageSource () {
	final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource ();
	
	if (!hasDojoProduction) {
		source.setCacheSeconds (0);
	}
	
	source.setBasenames ("WEB-INF/i18n/messages");
	source.setFallbackToSystemLocale (false);
	
	return source;
}
 
開發者ID:CDS-INSPIRE,項目名稱:InSpider,代碼行數:18,代碼來源:AdminWebMvcConfig.java

示例15: apiMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource apiMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames("classpath:message/restfulapi");
    messageSource.setFallbackToSystemLocale(false);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(3600);
    return messageSource;

}
 
開發者ID:CeON,項目名稱:saos,代碼行數:11,代碼來源:ApiConfiguration.java


注:本文中的org.springframework.context.support.ReloadableResourceBundleMessageSource.setCacheSeconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。