示例#1
0
 @Bean
 public MessageSource messageSource() {
   ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
   ms.setBasenames("message.error");
   ms.setDefaultEncoding("UTF-8");
   return ms;
 }
 @Bean
 public ResourceBundleMessageSource messageSource() {
   ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
   messageSource.setBasename("messages");
   messageSource.setUseCodeAsDefaultMessage(true);
   messageSource.setDefaultEncoding("UTF-8");
   return messageSource;
 }
  @Bean(name = "messageSource")
  public ResourceBundleMessageSource resourceBundleMessageSource() {

    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("WEB-INF/messages/messages");
    messageSource.setDefaultEncoding("UTF-8");

    return messageSource;
  }
 /**
  * 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;
 }