2

I've found that when I use the @ResponseStatus annotation on an unchecked error declaration, as discussed in this Baeldung article, it invalidates the @Transactional rollback behavior I'm relying on in my service layer.

How can I translate unchecked errors into HTTP responses without interfering with @Transactional?

Peter Alfvin
  • 28,599
  • 8
  • 68
  • 106
  • AFAIK `@ResponseStatus` shouldn't directly affect rollback behavior, unless you are *making* an HTTP call within the transaction that is now returning a non-successful response code. I believe [this](https://github.com/spring-projects/spring-framework/blob/e9cf645b86c39c66759492435e6d44b70736cee5/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java#L664) is the code that decides whether to rollback on exceptions if it helps for debugging. Otherwise, can you provide a reproducible example? – Knox Sep 24 '22 at 20:31

0 Answers0