vendredi 20 mars 2015

Spring ResourceBundleMessageSource is not loading a property file from a jar while ClassPathResource can

I am trying to load a message.properties file from a jar file, but it is not finding the file (and I have been trying for a few hours).



<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages/messages</value>
<value>classpath:org/common/messages/messages</value>
</list>
</property>
</bean>


But it cannot find it:



[org.springframework.context.support.ResourceBundleMessageSource] (http-/0:0:0:0:0:0:0:0:8080-5) ResourceBundle [classpath:org/common/messages/messages] not found for MessageSource: Can't find bundle for base name classpath:org/common/messages/messages, locale en_US


I have tried the following, and it does load the file, which I assume means the file is on the classpath



ClassPathResource cpr = new ClassPathResource("org/common/messages/messages.properties");


What is the difference?


I am running this on JBoss.


Aucun commentaire:

Enregistrer un commentaire