spring mvc主要是靠dispatcherServlet来调配..看名字也知道是个servlet,想脱离web容器运行? 可能有..但我觉得没必要
还是有必要的,再做持续集成的时候,你需要做单元测试,这个时候通常使用JUNIT来进行测试,在这种情况下, 直接对Controller来进行测试就比较有必要了。建议LZ去参照下面的文章: http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/testing.htmlUnit testing Spring MVC Controllers To test your Spring MVC Controllers, use ModelAndViewAssert combined with MockHttpServletRequest, MockHttpSession, and so on from the org.springframework.mock.web package.
xxxService service = (xxxService) context.getBean("xxxService");
service.doSomething();
LZ是说这样的东西吗?
还是有必要的,再做持续集成的时候,你需要做单元测试,这个时候通常使用JUNIT来进行测试,在这种情况下,
直接对Controller来进行测试就比较有必要了。建议LZ去参照下面的文章:
http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/testing.htmlUnit testing Spring MVC Controllers
To test your Spring MVC Controllers, use ModelAndViewAssert combined with MockHttpServletRequest, MockHttpSession, and so on from the org.springframework.mock.web package.