I have a multi module Spring project with Maven. I'm using Spring 3.2.3 with annotation config.
I have the following layout:
parent
common (depends on parent)
webapp (depends on parent, common, module1, module2)
module1 (depends on parent)
module2 (depends on parent)
I need that common
, module1
and module2
can specify their own i18n properties (and the webapp
collects those files and provides them somehow ?!):
common: src/main/resources/i18n/messages_en.properties
module1: src/main/resources/i18n/messages_en.properties
module2: src/main/resources/i18n/messages_en.properties
I tried using
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:/i18n/messages");
messageSource.setDefaultEncoding("UTF-8");
messageSource.setUseCodeAsDefaultMessage(true);
return messageSource;
}
But it seems like Spring will just use one of those translation files, but instead it should use all.
Another possibility would be to specify a unique properties file name for each module, but then I don't know what basename to set via messageSource.setBasename(...)
.
Thanks for your help!