I use this:
to load my ApplicationContext. myfile.xml is in src/main/resources
ApplicationContext context = new ClassPathXmlApplicationContext("myfile.xml");
My problem is that inside STS, maven puts the file in target/classes and everything is OK, but, when I create the JAR, myfile.xml is in /resources and it doesn't find the file.
If I change the sentece by
it works in the Jar but it doesn't work inside STS, because myfile.xml is at target/classes.
ApplicationContext context = new ClassPathXmlApplicationContext("resources/myfile.xml");
I've burned Google and I can't find any solutions.
I'm sure this is a common problem with a easy solution, that I can't obviously find. Thanks for your help and I apologize for my horrible English.