Sobes.tech
Junior — Middle

If one service method calls another method annotated with @Transactional, does a new transaction get created?

sobes.tech AI

Answer from AI

If a method annotated with @Transactional is called directly from another method within the same class (internal call), a new transaction is not created because Spring AOP proxies do not intercept internal calls.

A transaction will only be created if the call occurs externally through a proxy (for example, from another bean).

Thus, during an internal call to an annotated method, a new transaction will not start; instead, the current transaction will be used if it exists.