或者,要进行集成测试。
@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={"/applicationContext-test.xml"})@Transactionalpublic class MyTest { @Resource(name="myService") public IMyService myService;然后像往常一样使用该服务。将应用程序上下文添加到您的test / resources目录中



