0 votes
113 views
asked by (8.2k points)
Hi  All

  If i received unknown service end point have to return the 404 error . Can you please give sample code?

1 Answer

0 votes
answered by

Hi

  RequestMapping fallback method: We can create a fallback method for the controller class to make sure we are catching all the client requests even though there are no matching handler methods. It is useful in sending custom 404 response pages to users when there are no handler methods for the request.

@RequestMapping("*")
@ResponseBody
public String fallbackMethod(){
	return "fallback method";
}

Categories

...