我在我的项目中使用Spring框架。我想导入applicationContext配置文件中war文件的/WEB-INF/CustomerService/spring-integration/Jobs/
目录下的所有xml资源/文件。我试过以下几行代码,但没有工作。
<import resource= /WEB-INF/CustomerService/spring-integration/Jobs/*.xml"/>
<import resource="file:**/WEB-INF/CustomerService/spring-integration/Jobs/*.xml"/>
<import resource="file:///WEB-INF/CustomerService/spring-integration/Jobs/*.xml"/>
<import resource="file:WEB-INF/CustomerService/spring-integration/Jobs/*.xml"/>
有关如何使用Spring从war-file的WEB-INF加载的任何想法?
答案 0 :(得分:3)
WEB-INF目录路径在独立Spring项目中不能作为类路径使用。所以,我已经将配置文件移动到src/resources
文件夹,无需任何麻烦就可以导入它们。
答案 1 :(得分:0)
尝试使用classpath导入另一个XML配置文件。像这样:
<import resource="classpath:your_config.xml"/>
假设请求的配置文件位于类路径
中