My app has a scheduler job that gets some data from the database and then sends a POST request to another server. I need to handle some exceptions, but I cannot use @ControllerAdvice or @ExceptionHandler as there is no controller involved. What's the way to handle exceptions in this case?
Asked
Active
Viewed 371 times
0
-
The simplest way is of course to wrap the method that might throw an exception with a `try { ... } catch (...) { ... }` block. – Jesper Oct 07 '22 at 07:13
1 Answers
1
You can write your own @Advice
to catch all exception.
Check this already answered by @eric-b AOP Exception Handling

Dilwar Mandal
- 54
- 2
- 5