Capturing exceptions in spring

2

I'm using Spring and wanted to know how I can return @Repository and / or @Service exception errors for my webservice?

I have the following structure:

[ Webservice ] ------ [ @service/@Transactional ] ------- [ @Repository ]

When throwing some exception in my DAO what is the elegant way to treat and return to my webservice?

    
asked by anonymous 26.08.2015 / 18:16

1 answer

0

It depends on the webservice, if it is SOAP you will generate a FAULT as a response ... In general this is already mapped automatically when you generate the stubs ... If you are using pure http, rest, simply return a status that is in agreement with the error. For example: 500 to say that an unexpected error occurred, 400 to indicate bad parameters ...

    
28.10.2015 / 13:00