0

我很难为以下测试课程找到合适的答案:

@ContextConfiguration("classpath:services.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class RunnableServiceTest {

   @Test
   public void testConfiguration(){
       Collection<Service> lAllService = >>getBeansOfType(Service.class)<<;
       assertFalse(lAllService.isEmpty());
   }
}

我想从有界中收集所有 Spring 托管context services.xmlService.

我很确定一定有这样的东西,但我不知道我要搜索什么。

非常感谢您的帮助。

斯特凡

4

1 回答 1

1

您可以使用自动接线List

@ContextConfiguration("classpath:services.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class RunnableServiceTest {

   @Autowired
   private List<Service> lAllService;

   @Test
   public void testConfiguration(){
       assertFalse(lAllService.isEmpty());
   }
}
于 2015-11-25T09:49:10.347 回答