I think I ran into an error with my classpath settings.
I want to test an internationalized web-app which has the messagesource defined like this:
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>/WEB-INF/i18n/errors</value>
<value>/WEB-INF/i18n/messages</value>
<value>/WEB-INF/i18n/links</value>
<value>/WEB-INF/i18n/forms</value>
<value>/WEB-INF/i18n/communication</value>
</list>
</property>
</bean>
Loading these values works perfectly in a production environment.When running a Junit Test however, it can't resolve those property files because they are not on the classpath.
However, I want them to be NOT on the classpath because then I can make use of the feature where I can change something in the property files and it's reflected on the website immediately: Since application servers typically cache all files loaded from the classpath, it is necessary to store resources somewhere else (for example, in the "WEB-INF" directory of a web app). Otherwise changes of files in the classpath will not be reflected in the application.
The spring applicationContext is located there: /src/main/resources/spring/applicationContext.xml
and loaded into the Junit test with these annotations:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/spring/applicationContext.xml"})
How can I get Junit to pick up those non-classpath resources as well?The property files are on /src/main/webapp/WEB-INF/i18n/*
Junit: 4.7.
Spring: 3.0.5.