你的位置:首页 > Java教程

[Java教程]junit测试spring头部注入方式


@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();    }    

重点是头部注解