Spring 链接到春季HATEOAS中的演员问题
当我尝试形成如下链接时Spring 链接到春季HATEOAS中的演员问题,spring,rest,link-to,hateoas,Spring,Rest,Link To,Hateoas,当我尝试形成如下链接时 Link userLink = linkTo((controllerClass).slash("?location="+location+"&scheduledDepartur="+scheduleDepatur).withRel(USER_REL)); 它将错误显示为 The method slash(String) is undefined for the type Class<TrainController> 得到下面的错误 The meth
Link userLink = linkTo((controllerClass).slash("?location="+location+"&scheduledDepartur="+scheduleDepatur).withRel(USER_REL));
它将错误显示为
The method slash(String) is undefined for the type Class<TrainController>
得到下面的错误
The method slash(String) is undefined for the type HttpEntity<TrainStatus>.
请帮助我解决此问题。所有括号都已关闭
Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel());
应该是
Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale)).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel());
我很惊讶您拥有的那些查询字符串参数不是getOffTrains控制器方法上的方法。那么它就适合您了
Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale)).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel());