외부 bean 호출이 transaction proxy를 통과한다

Spring bean 참조를 통한 외부 호출은 proxy가 annotation을 해석해 transaction을 시작하지만 self-invocation은 target 내부에서 proxy를 우회한다.

외부 bean 호출 · transaction 적용
CALLER

Spring bean 참조

proxy 객체를 호출한다.

PROXY

Annotation 해석

interceptor가 manager에 begin을 요청한다.

TARGET

업무 method

활성 transaction 안에서 실행된다.

Self-invocation · proxy 우회
TARGET

this.inner()

같은 객체 내부에서 method를 직접 호출한다.

NO PROXY

Interceptor 없음

private method annotation도 가로채지 못한다.

RESULT

새 경계 없음

기존 transaction만 유지되거나 transaction 없이 실행된다.

핵심: @Transactional의 효과는 annotation 위치만이 아니라 runtime 호출이 proxy 경계를 통과하는지에 달려 있다.