@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {“classpath:applicationContext.xml”}) 在测试类前面加入这个