I've tried to use the Mkyong's guide to access external properties file, without any success.
This is my bean definition in web-osgi-context.xml file located in WEB-INF:
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:bundles/resource</value>
<value>classpath:bundles/override</value>
<value>file:c:/test/messages</value>
</list>
</property>
<property name="cacheSeconds" value="10"/>
</bean>
Accessing the bean:
@SpringBean
private ReloadableResourceBundleMessageSource messageSource;
Trying to extract the message like this:
String name = messageSource.getMessage("customer.name",
new Object[] { 28,"http://www.mkyong.com" }, Locale.US);
System.out.println("Customer name (English) : " + name);
I have messages_en_US.properties files in both C:/test/messages and C:/test folders. They contain following line:
customer.name=Test, age : {0}, URL : {1}
That's all I have, am I missing something? The message I get is:
org.springframework.context.NoSuchMessageException: No message found under code 'customer.name' for locale 'en_US'.
at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:155)
Btw, I also tried internal properties, also without success. I deploy my .war in my local servicemix(6.1.1), I also use wicket (6.24.0) and spring (3.2.14). Running mkyong's application(which is not a web application) locally (without deploying it on my local servicemix works).