Seems that question old as world, but I still can\'t find out the solution..
I\'m trying to run simple test:
@RunWith(SpringJUnit4ClassRunner.class)
I think best practice is to put your application context file for testing PersonsPopulateTest-context.xml under src/test/resources. This file will be copied into target/test-classes and you can refer to it in your test class as below:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:**/PersonsPopulateTest-context.xml"})
@Transactional
public class PersonsPopulateTest {
}
If you still want to refer to applicationContext.xml under src/main/resources, then you have to include it as follow:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"file:src/main/resources/applicationContext.xml"})
@Transactional
public class PersonsPopulateTest {
}
It worked for me.