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