Spring transaction: rollback on Exception or Throwable

前端 未结 4 2195
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 08:26

I wonder whether it makes sense to use instead of

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

to use

4条回答
  •  再見小時候
    2020-12-05 08:41

    I don't know is it possible or not but handling Throwables like Errors is a bad style of programming, it is not the developers responsibility to handle this kind of fatal errors. There always can happen bad things which You cannot handle. You should handle checked exceptions if necessary, which are known to your system like some type of logical errors.

提交回复
热议问题