dimanche 19 juin 2016

Get access to spring context from JUnit test

I try to run test for spring framework. I use only the xml context. In test (JUnit) class I specify

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"springContext.xml"})
public class MyTest extends TestCase {
    @Test
    public void test() {

    }
}

but I don't know how to get access to the spring context in the @Test method? I don't can use of @Autowired annotation, because I don't use annotation driven context

Aucun commentaire:

Enregistrer un commentaire