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