junit测试spring脑袋注入方式
junit测试spring头部注入方式
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/applicationContext.xml" }) @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class }) public class ServiceAttachmentServiceImplTest { @Resource private IServiceAttachmentService serviceAttachmentService; @Test//测试SQL语句 public void testSQL() { List<ServiceAttachment> atts = serviceAttachmentService .getScrollData().getResultList(); }
重点是头部注解