08-02-2023, 06:44 AM
Since the programmer is forced to catch all checked exception, I to throw checked exception in case of any problem. I would like to rollback on any of those expections. Writing `rollbackFor=Exception.class`on every `@Transactional` annotation is very error-prone, so I would like to tell spring, that: "whenever I write `@Transactional`, I mean `@Transactional(rollbackFor=Exception.class)`".
I know, that I could create a custom annotation, but that seems unnatural.
So is there a way to tell spring how it should handle checked excpetions _globally_?
I know, that I could create a custom annotation, but that seems unnatural.
So is there a way to tell spring how it should handle checked excpetions _globally_?