When I was writing the base code in Spring boot for my RESTifying the ZFS APIs project, I was looking for some way of throwing the exception to the user with HTTP error code. I found a way to handle it by using ResponseStatusExceptionResolver. ResponseStatusExceptionResolver is introduced with Spring 3, and Its main responsibility is to use the @ResponseStatus annotation available on custom exceptions and to map these exceptions to HTTP status codes. @ResponseStatus annotation I created a ValidationException class extending the RuntimeException class with a constructor. This is how my code looks like package in.asvignesh.zfsservice.controller; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus;…
Passionate Developer with 7 years of extensive experience working for Data center related products. Contributed and lead the efforts in Solutioning and engineering in Nimesa Technologies for developing Dataprotection and Copy data management product for Private and Public Clouds
This is my personal weblog, opinions expressed here represent my own and not those of my employer.
All content provided on this blog is for informational purposes only and i will not be liable for any errors, losses, or damages from the display or use of this information.