![maven install failed to load applicationcontext maven install failed to load applicationcontext](https://cayenne.apache.org/docs/3.1/getting-started-guide/images/maven-plugin-install.png)
![maven install failed to load applicationcontext maven install failed to load applicationcontext](http://antkorwin.com/cloud/commit.gif)
#MAVEN INSTALL FAILED TO LOAD APPLICATIONCONTEXT HOW TO#
These projects run together as an application but when function as Junit, I don't know how to load the context from a different project so I simply copied and pasted the file. Important point: The context.xml was actually copied from another project. Error message: : Failed to load ApplicationContextĪt .TestContext.getApplicationContext(TestContext.java:157)Īt .(DependencyInjectionTestExecutionListener.java:109)Īt .(DependencyInjectionTestExecutionListener.java:75)Īt .TestContextManager.prepareTestInstance(TestContextManager.java:321)Īt .(SpringJUnit4ClassRunner.java:211)Īt .junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)Īt .(ReflectiveCallable.java:15)Īt .(SpringJUnit4ClassRunner.java:290)Īt .(SpringJUnit4ClassRunner.java:231)Īt nChild(BlockJUnit4ClassRunner.java:50)Īt $3.run(ParentRunner.java:193)Īt $1.schedule(ParentRunner.java:52)Īt .runChildren(ParentRunner.java:191)Īt .access$000(ParentRunner.java:42)Īt $2.evaluate(ParentRunner.java:184)Īt .(RunBeforeTestClassCallbacks.java:61) MyObject myObject = springContext.getBean(myObject.class) īut neither way works for me. I have tried to do this job in two ways: 1, Use ApplicationContextĪppliactionContext springContext = new ClassPathXmlApplicationContext("/context.xml") In the pom.xml, I have: (As suggested by this post)
![maven install failed to load applicationcontext maven install failed to load applicationcontext](https://usermanual.wiki/Document/practicalguidetobuildinganapibackendwithspringboot1536592181564.1172267072/asset-21.png)
My context.xml is located at: src/main/resources/context.xmlĪfter maven build, the context.xml appears at: target/classes/context.xml I want to load spring context in order to use defined beans. I'm writing unit tests for a spring application which is sort of complex.