當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。