当前位置: 首页>>代码示例>>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;未经允许,请勿转载。