I have a java application that use spring with a spring.xml file in the web content. I have in my java class this piece of code:
ApplicationContext context = new ClassPathXmlApplicationContext("WEB-INF/spring-conf.xml");
WService ws = (WService) context.getBean("service");
In that spring.xml I import a xml file that lives in a library (bundle) that I’ve put in my project as an external library.
<import resource="classpath:/org/bundle/spring2.xml" />
and it works but in spring2.xml and in the bundle there are also:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>../properties/environment.properties</value>
</property>
</bean>
<import resource="../commons/datasources.xml"></import>
<import resource="../commons/context-resources.xml"></import>
and I can’t find these xml files because they live in the bundle, not in my webcontent.
How can I indicate in my spring-conf.xml the positions of the other xml files from the beginning?
If there are another method to do this you’re welcome.
Thank you very much.
Try importing yourself the XMLs in your
spring-conf.xml:and replace
PACKAGE_PATHwith the correct value 🙂