java - Jhipster RequestMapping from many Entities at once -
i'm new jhipster , spring, aim make requestmapping obtain data multiple entities json, example did test understand little:
@restcontroller @requestmapping("/keras") public class kerasmodelresource { private class test { private final int id; private final string test; public test() { this.id = 1; this.test = "2"; } public int getid() { return this.id; } public string gettest() { return this.test; } } private class testobject { private final int id; private final string test; private final test object; public testobject(int id, string test) { this.id = id; this.test = test; this.object = new test(); } public int getid() { return this.id; } public string gettest() { return this.test; } public test getobject() { return this.object; } } private final logger log = loggerfactory.getlogger(accountresource.class); private final testobject test; public kerasmodelresource() { this.test = new testobject(2, "3"); } /** * /authenticate : check if user authenticated, , return login. * * @param request http request * @return login if user authenticated */ @requestmapping(method=requestmethod.get) public @responsebody testobject gettest(httpservletrequest request) { log.debug("rest request test object"); return this.test; } }
so when localhost:8080/keras following:
{ "id" : 2, "test" : "3", "object" : { "id" : 1, "test" : "2" } }
however big problem have no idea how data other entities 1 requestmapping
if have doubts concerning whole project or architecture please dont hesitate ask. enjoy day
Comments
Post a Comment