springmvc4+Junit单元测试的几个重要点

/**
 * Created by dell on 2017/10/11.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration//必须
@ContextConfiguration(locations = {"classpath:/spring-mvc.xml", "classpath:/spring-config.xml"})
public class TestService {

    @Resource
    private CommonViewService commonViewService;

    @Test
    public void test1() {
        List list = commonViewService.getAgeGroup();
        System.out.println(list.toString());
    }

}
 
  
 
  
 
  
//spring4和一些早期的serverlet-api集成有bug

    javax.servlet
    javax.servlet-api
    3.0.1
    test



你可能感兴趣的:(Java技术,JSP技术)