Embedded tomcat won't resolve Spring application resource bundle for message source
-
12-12-2019 - |
Question
I am experiencing trouble with my embedded tomcat: when I run my Spring app using the embedded Tomcat, it seems the properties are not resolved.
Even if the properties file are loaded:
INFO org.springframework.context.support.PropertySourcesPlaceholderConfigurer - Loading properties file from file [/home/julien/Documents/donnees/projets/Site-Rencontres/java/target/classes/META-INF/i18n/application.properties]
The resource bundles are not found:
WARN org.springframework.context.support.ResourceBundleMessageSource - ResourceBundle [/META-INF/i18n/application] not found for MessageSource: Can't find bundle for base name /META-INF/i18n/application, locale fr
However, when I run my app from Eclipse/STS, I have no such issue.
Solution
I partially sorted the problem. By removing the leading slashes here (in the Spring config):
<property name="basenames" value="/META-INF/i18n/application,/META-INF/i18n/messages" />
to obtain this:
<property name="basenames" value="META-INF/i18n/application,META-INF/i18n/messages" />
the problem was resolved.
However what caused the difference of behavior between embedded Tomcat and standard Tomcat in the first place, I don't explain...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow