I'm using Spring 4 and use MessageSource for localization.
My xml file has:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:i18n/myfile"/>
<property name="defaultEncoding" value="UTF-8"/>
</bean>
One of the localization files, myfile_nl.properties has:
prop1=abc
other1=o1
other2=o2
other3=o3
The Java code to get the localized string is:
@Autowired
private MessageSource messageSource;
String localizedMsg = messageSource.getMessage("prop1", null, locale);
Now, I get exception that prop1 is not found. So, I edited the properties file to copy the prop1 later in the file.
other1=o1
other2=o2
prop1=abc
other3=o3
And now prop1 was detected.
Why is prop1 not getting detected when it was on first line?