@GetMapping("/myGetsomething")
@Transactional
public meDataClass givebyID(@PathVariable("ID") long id) throws NullPointerException {
try {
return postgresService.giveById(id);//возвращает экземпляр класса @Entity
} catch (NullPointerException e) {
throw new DataNotFoundException();
}
}
@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;
}