'Not throwing exception from a @Service's methods

I have a notification service(I have control of this class).

If there is any unchecked exception, then I do not want to throw it. But instead want to log it in a specific manner.

I can directly have try catch block in each method's implementation but I am in search of some magic here 😄

Is there a common way that this can be handled through Spring?


Update: AOP is also a way to do it. For example: https://dzone.com/articles/handling-exceptions-using-springs-aop Any other direct implementation for this?

This was my requirement but I was not able to find anything with respect to this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source