I have a controller like below
@Controller(\"myController\")
@RequestMapping(\"api\")
public class MyController {
@RequestMapping(method = RequestMetho
I get a solution and going to share this and also like to know any good suggestions.
@Controller("myController")
@RequestMapping("api")
public class MyController {
@RequestMapping(method = RequestMethod.GET, value = "/get/info/{id}", headers = "Accept=application/json")
public @ResponseBody
Student getInfo(@PathVariable String info) {
// ...
}
}
// ...
@ExceptionHandler(Throwable.class)
//@ResponseStatus( HttpStatus.EXPECTATION_FAILED)<
Expected out in rest client :
502 Bad Gateway
{
"status":"BAD_GATEWAY",
"error":"java.lang.UnsupportedOperationException",
"message":"Some error message"
}
Thanks for your replies. I still need pointers for good practices.