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


Java ResourceBundleMessageSource.setBasenames方法代碼示例

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


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

示例1: resolve

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Override
public void resolve(Component component) {
    if( component.isPlain()) return;
    logger.debug("Resolving {} {} feature", component, getName());
    ApplicationContext parent = resolveContext.getRootContext() ;
    ClassLoader realm = component.getClassLoader();
    //在根據配置的情況下,根據 manifest裏麵的App-Message加載資源
    String appMessage = getAppMessage(component);
    if(StringUtils.isNotBlank(appMessage)){
        CombinedMessageSource combined  = parent.getBean(CombinedMessageSource.class);
        ResourceBundleMessageSource source = new ResourceBundleMessageSource();
        source.setBundleClassLoader(realm);
        source.setBasenames(StringUtils.split(appMessage, CONFIG_LOCATION_DELIMITERS));
        combined.combine(source);
    }
    resolveContext.registerFeature(component, getName(), realm);
}
 
開發者ID:Kadvin,項目名稱:spring-component-framework,代碼行數:18,代碼來源:StaticFeatureResolver.java

示例2: defaultMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource defaultMessageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasenames("messages", "i18n/messages");
    messageSource.setDefaultEncoding(Charset.forName("UTF-8").name());
    messageSource.setFallbackToSystemLocale(true);
    messageSource.setCacheSeconds(-1);
    messageSource.setAlwaysUseMessageFormat(false);
    messageSource.setUseCodeAsDefaultMessage(true);
    return messageSource;
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:12,代碼來源:LocaleConfiguration.java

示例3: onContextRefreshed

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Override
public void onContextRefreshed() {
    Set<String> messages = new HashSet<>();
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    for (String beanName : BeanFactory.getBeanNames()) {
        Package beanPackage = BeanFactory.getBeanClass(beanName).getPackage();
        if (beanPackage == null) {
            logger.warn(null, "無法獲得Bean[{}]包。", beanName);

            continue;
        }

        String packageName = beanPackage.getName();
        if (resolver.getResource(packageName.replace('.', File.separatorChar) + "/message.properties").exists())
            messages.add(packageName);
    }

    String[] names = new String[messages.size()];
    int i = 0;
    for (String name : messages)
        names[i++] = name + ".message";
    messageSource = new ResourceBundleMessageSource();
    messageSource.setDefaultEncoding(context.getCharset(null));
    messageSource.setBasenames(names);
}
 
開發者ID:heisedebaise,項目名稱:tephra,代碼行數:26,代碼來源:MessageImpl.java

示例4: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * @return ResourceBundleMessageSource pour les messages de l'application
 */
@Bean
public ResourceBundleMessageSource messageSource() {
	ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
	resourceBundleMessageSource.setBasenames(
			"i18n/messages",
			"i18n/backoffice/backoffice-messages",
			"i18n/backoffice/nomenclature-messages",
			"i18n/candidat/candidat-messages");
	resourceBundleMessageSource.setFallbackToSystemLocale(false);
	return resourceBundleMessageSource;
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:15,代碼來源:SpringConfig.java

示例5: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource messageSource() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasenames("i18n/messages");
    source.setUseCodeAsDefaultMessage(true);
    source.setDefaultEncoding("UTF-8");
    return source;
}
 
開發者ID:JUGIstanbul,項目名稱:second-opinion-api,代碼行數:9,代碼來源:LocalizationConfiguration.java

示例6: before

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Before
public void before() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasenames("messages");
    messageSource.setDefaultEncoding("UTF8");
    clientEnumController = new ClientEnumController(messageSource);
    clientEnumController.registerClientEnum(Gender.class);
}
 
開發者ID:Catalysts,項目名稱:cat-boot,代碼行數:9,代碼來源:ClientEnumControllerTest.java

示例7: validationMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource validationMessageSource() {
  ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
  messageSource.setBasenames("validation");
  messageSource.setDefaultEncoding("utf8");
  return messageSource;
}
 
開發者ID:puncha,項目名稱:petclinic,代碼行數:8,代碼來源:WebConfig.java

示例8: createValidator

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
public static Validator createValidator() {
  LocaleContextHolder.setLocale(Locale.ENGLISH);
  ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
  messageSource.setFallbackToSystemLocale(false);
  messageSource.setBasenames("validation");
  messageSource.setDefaultEncoding("utf8");

  LocalValidatorFactoryBean localValidator = new LocalValidatorFactoryBean();
  localValidator.setValidationMessageSource(messageSource);
  localValidator.afterPropertiesSet();
  return localValidator;
}
 
開發者ID:puncha,項目名稱:petclinic,代碼行數:13,代碼來源:TestUtil.java

示例9: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource messageSource() {
	ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource();
	bundleMessageSource.setUseCodeAsDefaultMessage(true);
	bundleMessageSource.setBasenames(i18nMessages.split(","));
	return bundleMessageSource;
}
 
開發者ID:xiangxik,項目名稱:java-platform,代碼行數:8,代碼來源:I18nConfiguration.java

示例10: searchOperations

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean public ResourceBundleMessageSource searchOperations() {
    ResourceBundleMessageSource bundle = new ResourceBundleMessageSource();
    bundle.setFallbackToSystemLocale(false);
    bundle.setBasenames("com/jongsoft/harvester/service/operations");
    bundle.setBundleClassLoader(ServiceConfiguration.class.getClassLoader());
    return bundle;
}
 
開發者ID:gjong,項目名稱:web-harvester,代碼行數:8,代碼來源:ServiceConfiguration.java

示例11: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource messageSource() {
    ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
    resourceBundleMessageSource.setBasenames("GerenciarUsuarios");
    resourceBundleMessageSource.setDefaultEncoding("UTF-8");
    return resourceBundleMessageSource;
}
 
開發者ID:servicosgovbr,項目名稱:editor-de-servicos,代碼行數:8,代碼來源:WebMVCConfig.java

示例12: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource messageSource() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasenames("i18n/message");
    source.setUseCodeAsDefaultMessage(true);
    return source;
}
 
開發者ID:cyzaoj,項目名稱:mywx,代碼行數:8,代碼來源:MvcConfig.java

示例13: createMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * 文言定義を生成する。
 * 
 * @return 文言定義。
 */
private MessageSource createMessageSource() {
	ResourceBundleMessageSource msgSrc = new ResourceBundleMessageSource();
	msgSrc.setBasenames("message/launcher", "message/batchId");
	msgSrc.setUseCodeAsDefaultMessage(true);
	return msgSrc;
}
 
開發者ID:agwlvssainokuni,項目名稱:sqlapp,代碼行數:12,代碼來源:Launcher.java

示例14: initializeMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean(name = "messageSource")
public ResourceBundleMessageSource initializeMessageSource() {
    ResourceBundleMessageSource resource = new ResourceBundleMessageSource();

    resource.setBasenames("l10n/general");

    return resource;
}
 
開發者ID:osiam,項目名稱:addon-administration,代碼行數:9,代碼來源:WebMvcConfig.java

示例15: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasenames("alfio.i18n.public", "alfio.i18n.admin");
    //since we have all the english translations in the default file, we don't need
    //the fallback to the system locale.
    source.setFallbackToSystemLocale(false);
    source.setAlwaysUseMessageFormat(true);
    return source;
}
 
開發者ID:alfio-event,項目名稱:alf.io,代碼行數:11,代碼來源:DataSourceConfiguration.java


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