Spring rolls back on runtime exceptions by default.
In Spring, a transaction is automatically rolled back if a runtime exception is thrown. However, checked exceptions do not lead to a rollback unless explicitly configured. For example, if a RuntimeException occurs during order processing, the transaction will roll back. To roll back on a checked exception, you must configure the rollbackFor attribute in @Transactional.