I am trying to write integration test with spring. Below is the test class
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:**/context*.xml"})
public class MyFirstTestClass {
@AutoWired
private ApplicationContext applicationContext;
@Test
public void testApplicationContext {
applicationContext.getName();
}
}
When i run the test from maven i am getting null pointer exception because applicationContext is null.Iam not able to understand the reason.Also in logs also i dont see any error.I tried putting configuration in one of the application context files. Still iam getting same error.
When i use classpath*:**/context*.xml to create context manually it works. But i believe when i use context configuraton its not loading the application context file.I am not getting any error as well. Kindly suggest
Aucun commentaire:
Enregistrer un commentaire