@Bean public ResourceBundleMessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasename("messages"); messageSource.setUseCodeAsDefaultMessage(true); 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; }
@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; }
private void prepareMessageSource() { messageSource = new ResourceBundleMessageSource(); messageSource.setBasename("messages/messages"); messageSource.setUseCodeAsDefaultMessage(true); }