Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3715

What is the best way to return different types of ResponseEntity in Spring-Boot (Error Handling for REST with Spring)

$
0
0

I have written simple REST application in Spring Boot (Spring Framework).

It returns ResponseEntity<Success> as Success response in the controller level. But I want to return a completely different Error response ResponseEntity<Error>, if there is an error (validation error, logic error, runtime error) in the API.

Success& Error responses are completely different for the application.Success& Error are the 2 java classes which the application uses to represent Success& Error responses.

What is the best way to return different types of ResponseEntity in Spring-Boot (Best way to handle the errors for REST with Spring)?


Viewing all articles
Browse latest Browse all 3715

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>