Reputation: 2005
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
Upvotes: 0
Views: 2193
Reputation: 4347
The test class is like a regular bean. So far you can use both of those in your test class:
See How to inject ApplicationContext itself
Upvotes: 2