Reputation: 1023
My code instantiates a spring instance using the following code:
String filePath = "applicationContext.xml";
ApplicationContext context = new ClassPathXmlApplicationContext(filePath);
This works if I put a file named "applicationContext.xml" in the root of a jar in my WEB-INF/lib folder. However, I would prefer to have a file named "applicationContext.xml" in my WEB-INF/classes folder. I have tried the following values for filePath and all of them generate a FileNotFoundException:
applicationContext.xml
/webappName/WEB-INF/classes/applicationContext.xml
/WEB-INF/classes/applicationContext.xml
classes/applicationContext.xml
None of these has worked. What is the correct syntax to use with ClassPathXmlApplicationContext to read an xml file out of the WEB-INF/classes folder?
Upvotes: 2
Views: 3009