コード例 #1
0
 @Bean
 public ResourceBundleMessageSource messageSource() {
   ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
   messageSource.setBasename("messages");
   messageSource.setUseCodeAsDefaultMessage(true);
   messageSource.setDefaultEncoding("UTF-8");
   return messageSource;
 }
コード例 #2
0
 /**
  * Bean koji sluzi da bi locirali properties datoteke za poruke.
  *
  * @return
  */
 @Bean
 public ResourceBundleMessageSource messageSource() {
   final ResourceBundleMessageSource source = new ResourceBundleMessageSource();
   String[] basenamesSpecific = {
     "properties.messages.common.messages", "properties.messages.app.application"
   };
   source.setBasenames(basenamesSpecific);
   source.setUseCodeAsDefaultMessage(true);
   source.setDefaultEncoding("UTF-8");
   return source;
 }
コード例 #3
0
  @Bean
  public MessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();

    messageSource.setBasename(
        environment.getRequiredProperty(PROPERTY_NAME_MESSAGESOURCE_BASENAME));
    messageSource.setUseCodeAsDefaultMessage(
        Boolean.parseBoolean(
            environment.getRequiredProperty(
                PROPERTY_NAME_MESSAGESOURCE_USE_CODE_AS_DEFAULT_MESSAGE)));

    return messageSource;
  }
コード例 #4
0
 private void prepareMessageSource() {
   messageSource = new ResourceBundleMessageSource();
   messageSource.setBasename("messages/messages");
   messageSource.setUseCodeAsDefaultMessage(true);
 }