本文整理汇总了Java中org.springframework.context.support.ResourceBundleMessageSource.addBasenames方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceBundleMessageSource.addBasenames方法的具体用法?Java ResourceBundleMessageSource.addBasenames怎么用?Java ResourceBundleMessageSource.addBasenames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.support.ResourceBundleMessageSource
的用法示例。
在下文中一共展示了ResourceBundleMessageSource.addBasenames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeClass
import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@BeforeClass
public void beforeClass()
{
AllPropertiesMessageSource molgenisLocalizationMessages = new AllPropertiesMessageSource();
molgenisLocalizationMessages.addMolgenisNamespaces("web");
ResourceBundleMessageSource hibernateValidationMessages = new ResourceBundleMessageSource();
hibernateValidationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
molgenisLocalizationMessages.setParentMessageSource(hibernateValidationMessages);
MessageSourceHolder.setMessageSource(molgenisLocalizationMessages);
globalError = new ObjectError("entityCollectionRequestV2", new String[] { "TwoFieldsSet" }, new Object[] { 1 },
"must have two fields set");
fieldError = new FieldError("entityCollectionRequestV2", "num", -10, false,
new String[] { "Min.entityCollectionRequestV2.num", "Min.num", "Min.int", "Min" }, new Object[] {
new DefaultMessageSourceResolvable(new String[] { "entityCollectionRequestV2.num", "num" }, null,
"num"), 0 }, "must be greater than or equal to 0");
}
示例2: messageSource
import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource()
{
ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
resourceBundleMessageSource.setDefaultEncoding("UTF-8");
resourceBundleMessageSource.addBasenames("templates/index");
return resourceBundleMessageSource;
}
示例3: messageSource
import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@Bean
public MessageSource messageSource()
{
LocalizationMessageSource localizationMessageSource = new LocalizationMessageSource(messageFormatFactory,
localizationRepository(), () -> new Locale(appSettings.getLanguageCode()));
ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
resourceBundleMessageSource.addBasenames("org.hibernate.validator.ValidationMessages");
localizationMessageSource.setParentMessageSource(resourceBundleMessageSource);
MessageSourceHolder.setMessageSource(localizationMessageSource);
return localizationMessageSource;
}
示例4: beforeClass
import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@BeforeClass
public void beforeClass()
{
ResourceBundleMessageSource validationMessages = new ResourceBundleMessageSource();
validationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
TestAllPropertiesMessageSource messageSource = new TestAllPropertiesMessageSource(new MessageFormatFactory());
messageSource.addMolgenisNamespaces("data", "web");
messageSource.setParentMessageSource(validationMessages);
MessageSourceHolder.setMessageSource(messageSource);
}