当前位置: 首页>>代码示例>>Java>>正文


Java ReloadableResourceBundleMessageSource.setBasename方法代码示例

本文整理汇总了Java中org.springframework.context.support.ReloadableResourceBundleMessageSource.setBasename方法的典型用法代码示例。如果您正苦于以下问题:Java ReloadableResourceBundleMessageSource.setBasename方法的具体用法?Java ReloadableResourceBundleMessageSource.setBasename怎么用?Java ReloadableResourceBundleMessageSource.setBasename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.context.support.ReloadableResourceBundleMessageSource的用法示例。


在下文中一共展示了ReloadableResourceBundleMessageSource.setBasename方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
    messageBundle.setBasename("classpath:messages/messages");
    messageBundle.setDefaultEncoding("UTF-8");
    return messageBundle;
}
 
开发者ID:rovaniemi,项目名称:remember-me-back,代码行数:8,代码来源:CorsConfiguration.java

示例2: 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

示例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: shouldReturnTheFormattedLocalizedMessage

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Test
public void shouldReturnTheFormattedLocalizedMessage() {
    CurrentLocale locale = new CurrentLocale();
    ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setBasename("test_message");
    MessageSourceAccessor accessor = new MessageSourceAccessor(source);
    Localizer localizer = new Localizer(accessor, locale);

    assertThat(localizer.localize("hello_world"), is("Hello World"));

    locale.setLocaleString(Localizer.LOCALE_ENGLISH_US);
    assertThat(localizer.localize("MY_HOME", "San Francisco"), is("My home is San Francisco"));

    locale.setLocaleString(Localizer.LOCALE_KANNADA);
    assertThat(localizer.localize("MY_HOME", "ಬೆಂಗಳೂರು"), is("ನಮ್ಮ ಊರು ಬೆಂಗಳೂರು"));

    locale.setLocaleString(Localizer.LOCALE_KANNADA);
    assertThat(localizer.localize("MY_BIRTHDAY", new DateTime(1984, 12, 23, 14, 0, 0, 0, DateTimeZone.UTC).toDate()), is("ನನ್ನ ಹುಟ್ಟು ಹಬ್ಬ 12/23/84"));

    locale.setLocaleString(Localizer.LOCALE_ENGLISH_US);
    assertThat(localizer.localize("MY_BIRTHDAY", new DateTime(1984, 12, 23, 14, 0, 0, 0, DateTimeZone.UTC).toDate()), is("My birthday is 12/23/84"));

}
 
开发者ID:gocd,项目名称:gocd,代码行数:24,代码来源:LocalizerTest.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: emailMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
@Description("Spring mail message resolver")
public MessageSource emailMessageSource() {
    log.info("loading non-reloadable mail messages resources");
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasename("classpath:/mails/messages/messages");
    messageSource.setDefaultEncoding(CharEncoding.UTF_8);
    return messageSource;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:10,代码来源:ThymeleafConfiguration.java

示例7: apiErrorMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "apiErrorMessageSource")
public ReloadableResourceBundleMessageSource apiErrorMessageSource() {
    ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
    messageBundle.setBasename("classpath:error_messages");
    messageBundle.setDefaultEncoding("UTF-8");
    messageBundle.setUseCodeAsDefaultMessage(true);
    return messageBundle;
}
 
开发者ID:barrykalok,项目名称:spring-boot-drools-example,代码行数:9,代码来源:CommonConfig.java

示例8: 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

示例9: DeviceDataURLs

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
public DeviceDataURLs(Device device, Locale locale) {
	ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
       messageSource.setBasename("classpath:/messages/devices");
       messageSource.setDefaultEncoding("UTF-8");

       httpHostName = pubServerConfig.getHttpHostname();
       httpPort = pubServerConfig.getHttpPort();
       httpsPort = pubServerConfig.getHttpsPort();
       mqttHostName = pubServerConfig.getMqttHostName();
       mqttPort = pubServerConfig.getMqttPort();
       mqttTlsPort = pubServerConfig.getMqttTlsPort();
       context = pubServerConfig.getHttpCtx();
       channel = messageSource.getMessage("model.device.channel", null, locale);
       username = device.getApiKey();

       if (httpHostName.equalsIgnoreCase("localhost")) {
           this.httpHostName = "<ip>";
       }
       if (mqttHostName.equalsIgnoreCase("localhost")) {
       	mqttHostName = "<ip>";
       }
       if (StringUtils.hasText(device.getApplication().getDataApiDomain())) {
       	httpHostName = device.getApplication().getDataApiDomain();
       }        
       if (StringUtils.hasText(device.getApplication().getDataMqttDomain())) {
       	mqttHostName = device.getApplication().getDataMqttDomain();
       }
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:29,代码来源:DeviceRegisterService.java

示例10: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Primary
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() { // @todo not working
    ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
    messageBundle.setBasename("classpath:messages");
    messageBundle.addBasenames("classpath:messages", "classpath:validation");
    messageBundle.setUseCodeAsDefaultMessage(true);
    messageBundle.setDefaultEncoding("UTF-8");
    messageBundle.setFallbackToSystemLocale(true);

    return messageBundle;
}
 
开发者ID:bulktrade,项目名称:SMSC,代码行数:13,代码来源:AppConfiguration.java

示例11: emailMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
@Description("Spring mail message resolver")
public MessageSource emailMessageSource() {
  log.info("loading non-reloadable mail messages resources");
  ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
  messageSource.setBasename("classpath:/mails/messages/messages");
  messageSource.setDefaultEncoding(CharEncoding.UTF_8);
  return messageSource;
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:10,代码来源:ThymeleafConfiguration.java

示例12: 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

示例13: getMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource getMessageSource() {
  ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
  resource.setBasename("classpath:messages");
  resource.setDefaultEncoding("UTF-8");
  return resource;
}
 
开发者ID:smah3sh,项目名称:mcs,代码行数:8,代码来源:MatchmakerCloudSearchConfiguration.java

示例14: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
/**
 * This bean tells the application which message bundle to use.
 * 
 * @return The message bundle source
 */
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource()
{
	ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();

	messageBundle.setFallbackToSystemLocale(false);
	messageBundle.setBasename("classpath:messages/messages");
	messageBundle.setDefaultEncoding("UTF-8");

	return messageBundle;
}
 
开发者ID:yonadev,项目名称:yona-server,代码行数:17,代码来源:CoreConfiguration.java

示例15: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource() {
	ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
	source.setBasename("classpath:/io/lavagna/i18n/messages");
	source.setUseCodeAsDefaultMessage(true);
	source.setFallbackToSystemLocale(false);
	return source;
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:9,代码来源:PersistenceAndServiceConfig.java


注:本文中的org.springframework.context.support.ReloadableResourceBundleMessageSource.setBasename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。