@GetMapping("/myGetsomething")
@Transactional
public meDataClass givebyID(@PathVariable("ID") long id) throws NullPointerException {
try {
return postgresService.giveById(id);//возвращает экземпляр класса @Entity
} catch (NullPointerException e) {
throw new DataNotFoundException();
}
} {
"plus_code" : {
"compound_code" : "P27Q+MC New York, NY, USA",
"global_code" : "87G8P27Q+MC"
}
}public class plusscode:
{
private extend extend;
//Getters Setters
public class extend:
private String compound_code;
privtae String global_code;
//Getters Setters
}}@RequestMapping(value = "/some_city/", method = RequestMethod.POST)
public @ResponseBody SomeCity someCity(@RequestParam(value = "somecity", required = true) String somecity) throws Exception {
Gson gson = new Gson();
SomeCity data = gson.fromJson(somecity, SomeCity.class);
return data;
} SomeCity data = gson.fromJson(somecity, SomeCity.class);public class SomeCity {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}