For some tests, I need to use prod-context and test-context. But Spring can't find my context.
I've tried to put context in a different location, also tried to upload context with various loader.
I have my context in the resources classpath.
Entities-src-test-java-Dao-test1
-resources-META-INF-spring
My full path is C:\Git\Application\Entities\src\test\resources\META-INF\spring
When I try, for example
public class test1{
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("test-beans.xml");
...
or
@ContextConfiguration("file:/C://Git/Application/Entities/src/test/resources/META-INF/spring/test-beans.xml")
public class test1{
...
Or other various... I got error
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [test-beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [test-beans.xml] cannot be opened because it does not exist
If I start that class in debugger and check System.getProperty("user.dir")
I will see C:\Git\Application
or new File(".").getAbsolutePath();
shows me C:\Git\Application\.
How to solve that?
Aucun commentaire:
Enregistrer un commentaire