Reputation: 1558
I have a spring project. I have created different properties files for different modules and these files are in their respective directories.
For example, in "resources" folder, I have "student" and "teacher" folders. In student folder, I have student_en.properties and in teacher folder, I have teacher_en.properties. Now how do I configure it in spring so that I can get locale specific properties from all files using "ReloadableResourceBundleMessageSource" or any other bean.
Right now, it is -
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames"
value="classpath:messages" />
</bean>
Can I use regex or somehow include property files in all sub-directories of resources folder?
Upvotes: 0
Views: 3817
Reputation: 14149
Basenames accepts array as a parameter:
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<util:list>
<value>classpath:student/student</value>
<value>classpath:teacher/teacher</value>
</util:list>
</property>
</bean>
Upvotes: 2