Есть файл http://static.springsource.org/spring/docs/2.5.6/reference/testing.html, как добавить поддержку IoC для тестов junit с помощью xml-конфигурации, но я не могу найти пример для java на основе конфигурации...
Например, у меня есть java-based bean:
public class AppConfig
{
@Bean
public Test getTest() { return new Test(); }
}
И тест:
@RunWith(SpringJUnit4ClassRunner.class)
public class IocTest
{
@Autowired
private Test test;
@Test
public void testIoc()
{
Assert.assertNotNull(test);
}
}
Что нужно добавить, чтобы включить java-интерфейс beans в мой junit-тест без использования xml-config?
Обычно я использую:
new AnnotationConfigApplicationContext(AppConfig.class);
но он не работает для тестов...