Spring @Transactional rollback
Free Spring Boot module: @Transactional rollback, self-invocation, and propagation. First topics open in the browser — no sign-up.
Free Spring Boot module on @Transactional, propagation, self-invocation, and why rollback does not run. First topics open with no account.
The classic bug is @Transactional on a private method, or this.save() inside the same class, so the Spring proxy never starts a transaction. Runtime exceptions roll back by default; checked exceptions do not unless rollbackFor is set.
This guest module is the transactions track paid users study. Pair it with the HikariCP lab: an open transaction can also hold a connection and starve the pool.
What you will cover
- @Transactional proxy and self-invocation
- REQUIRED vs REQUIRES_NEW propagation
- rollbackFor and checked exceptions
- Private methods never start a transaction
- First topics free in the browser
Related free labs and modules
Common questions
Why is Spring @Transactional not rolling back?
Usually the method is not called through the Spring proxy (self-invocation or private/final), or the exception type is not a RuntimeException and rollbackFor was omitted. This module walks through those cases.
Can I learn Spring transactions without signing up?
Yes. The first topics of this Spring Boot transactions module are free. Sign in for the rest of the track and saved progress.
Does an open transaction exhaust HikariCP?
It can. A transaction holds a JDBC connection until commit or rollback. Long or leaked transactions look like pool exhaustion. Use this module with the HikariCP lab.
Free Spring Boot debug challenges · Free debug challenges · Java Spring Boot path · Create free account