Java Code Examples for org.springframework.context.support.ResourceBundleMessageSource#addBasenames()

The following examples show how to use org.springframework.context.support.ResourceBundleMessageSource#addBasenames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N2oMessagesConfiguration.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Bean("n2oMessageSource")
@ConditionalOnMissingBean(name = "n2oMessageSource")
public MessageSource n2oMessageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setDefaultEncoding(encoding.name());
    messageSource.setCacheSeconds(cacheSeconds);
    messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
            StringUtils.trimAllWhitespace(basename)));
    messageSource.addBasenames("n2o_messages", "n2o_content");
    return messageSource;
}
 
Example 2
Source File: LocalizationConfig.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example 3
Source File: RestControllerTest.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
@BeforeAll
static void beforeClass() {
  DataConverter.setConversionService(new DefaultFormattingConversionService());

  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);
}
 
Example 4
Source File: RestControllerV2Test.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
@BeforeAll
static void beforeClass() {
  ResourceBundleMessageSource validationMessages = new ResourceBundleMessageSource();
  validationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
  TestAllPropertiesMessageSource messageSource =
      new TestAllPropertiesMessageSource(new MessageFormatFactory());
  messageSource.addMolgenisNamespaces("data", "web", "data-security");
  messageSource.setParentMessageSource(validationMessages);
  MessageSourceHolder.setMessageSource(messageSource);
}