我是 Spring MVC 的新手,我使用 spring MVC 和 resteasy 编写了 web 服务。我的控制器工作正常,现在需要编写测试用例,但我尝试了 writtig,但我从未成功我也遇到了自动装配问题。
@控制器
@Path("/searchapi")
公共类 SearchAPIController 实现 ISearchAPIController {
@自动连线
私有 ISearchAPIService srcapiservice;
@得到
@Path("/{domain}/{group}/search")
@Produces({"application/xml", "application/json"})
公共集合 getSolrData(
@PathParam("domain") 最终字符串域,
@PathParam("group") 最终字符串组,
@Context final UriInfo uriinfo) 抛出异常 {
System.out.println("登陆获取****************");
返回 srcapiservice.getData(域,组,uriinfo);
}
}
谁能给我 Spring mvc 中测试用例的示例代码。