【发布时间】:2016-05-20 11:36:43
【问题描述】:
我在我的项目中使用 spring DAO 和 spring mvc,一旦我尝试访问 在 url 下面我得到了大量的 json 并且在我停止程序之前不会停止。我无法弄清楚这一点,有人可以解释这里发生了什么。
url :- //http://localhost:8080/plans/11/more
//controller
@ResponseBody
@RequestMapping(value="plans/{pid}/more",method=RequestMethod.GET)
public Travel showMore(@PathVariable int pid ){
Travel travel = travelRep.findOne(pid);
return travel;
}
模型类
public class Travel implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Integer idtravel;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idtravel")
private Set<Travellocation> travellocationSet;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idtravel")
private Set<Transactions> transactionsSet;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idtravel")
private Set<Travelmode> travelmodeSet;
}
//假设模型类中的属性有getter和setter。
【问题讨论】:
标签: java spring web-services rest spring-mvc