Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/transaction-and-consistency-models/concept/concept-adapter-outbound-persistence-jpa-c11.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00

45 lines
2.9 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-persistence-jpa-c11
title: Spring stereotype이 있다고 runtime에 도달하지 않는다
topic: transaction-and-consistency-models
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-persistence-jpa-c11
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-persistence-jpa-c11
file: ../../../final/evidence/rendered/adapter-outbound-persistence-jpa-c11.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-persistence-jpa-c11.txt
source:
- 원본 분석 절은 analysis/05-adapter-outbound-persistence-jpa.md#L788 이다.
module: adapter-outbound-persistence-jpa
---
# Spring stereotype이 있다고 runtime에 도달하지 않는다
root `CaSkeletonApplication`이 persistence package를 broad scan에서 의도적으로 제외하므로, adapter leaf 내부의 `@Component`가 자동으로 등록되지 않는다. `SpringTransactionPort``JpaAdapterComponentsConfig`의 narrow component scan으로 등록된다.
## 본문
<!-- body:start -->
`SpringTransactionPort``PolicyTransactionPort`를 구현하며 `JpaAdapterComponentsConfig`의 narrow component scan으로 등록된다. 이 wiring은 중요하다 — root `CaSkeletonApplication`은 persistence package를 broad scan에서 의도적으로 제외한다. 그래서 adapter leaf 내부의 `@Component`를 "annotation이 있으니 알아서 등록될 것"이라고 볼 수 없다.
## SpringTransactionPort 참조 위치
:::evidence key="adapter-outbound-persistence-jpa-c11" alt="코드베이스에서 SpringTransactionPort 를 검색한 출력 11줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="SpringTransactionPort 코드베이스 검색 — 11줄 · exit 0" zoom="true"
:::
## 이 배치를 만든 과거 회귀
`JpaAdapterComponentsConfig` source에 기록돼 있다. persistence package를 broad scan에서 제외했고, `SpringTransactionPort` 같은 component를 별도 scan하지 않았다. 처음 transaction port가 필요한 capability가 조립될 때 unsatisfied dependency로 드러났고, 해결은 JPA master switch 아래에서만 persistence adapter package를 narrow scan하는 것이었다. current root는 `PersistenceJpaRootAutoConfiguration -> JpaAdapterComponentsConfig -> component scan` 체인을 통해 이를 해결한다.
## inRootWrite가 inWrite와 다른 지점
`inWrite``inRootWrite` 둘 다 REQUIRED · READ_COMMITTED · read-only false로 매핑된다. 특히 vendor default isolation에 맡기지 않고 READ_COMMITTED를 명시한다. 그런데 `inRootWrite`는 시작 전에 `TransactionSynchronizationManager.isActualTransactionActive()`를 확인해 ambient physical transaction이 있으면 manager/action 호출 전에 거부한다. "root boundary"를 REQUIRED의 join semantics로 조용히 바꾸지 않는다.
<!-- body:end -->