<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title>GUIDE — Java + Jakarta EE / MicroProfile under the Discipline, v0.1 (overlay)</title>
  <p p="1">**Status.** Beta; overlay on `GUIDE-JAVA-v0.1.xml`. Composes with the GraalVM overlay via build-time-CDI runtimes; never with the Spring overlay (one container per target). Only named sections rewired.</p>
  <p p="2">Framing note. Jakarta EE is the one platform in the whole study whose own architecture *is* the Discipline's triple: **specifications** (the Jakarta/MicroProfile documents) ↔ **implementations** (vendors) ↔ **conformance suites** (the TCKs). A platform that certifies implementations against a spec with an executable test kit has already conceded every philosophical point this Discipline argues; the overlay's job is merely to keep application code as honest as the platform's governance. Practically it is the Spring overlay's sibling: CDI is the container, the resolution is the same **framework-free core with ring placement** — so this guide states only the deltas.</p>
  <p p="3">**Scope honesty.** MicroProfile-era services on certified runtimes (Open Liberty, Quarkus, Helidon, Payara, WildFly). Classic monolithic EE estates enter via the brownfield protocol as adopted code.</p>
  <section id="baseline" title="§0 additions — baseline">
    <list ordered="false" p="4">
      <item>**Pin the spec levels, not just the runtime:** the target Jakarta EE platform/profile version and MicroProfile version are declared in the build; vendor BOM pinned. **Portability is a check, not a hope:** cells and seams depend on `jakarta.*`/`org.eclipse.microprofile.*` APIs at most (boundary), vendor packages (`io.quarkus..`, `com.ibm..`, etc.) are boundary-of-boundary — ArchUnit-enforced, and the rule is what keeps the second implementation possible.</item>
      <item>**TCK resonance, used not admired:** where a seam wraps a platform service, the platform's own TCK answers "does the runtime behave"; conform answers "does our code behave" — the two suites are complementary GEP rows, not overlap.</item>
    </list>
  </section>
  <section id="cdi" title="§1&apos;/§3&apos; — CDI as composition root">
    <list ordered="false" p="5">
      <item>**No `@Inject`, no scopes, no interceptor bindings inside cells.** Cells are `new`-constructed.</item>
      <item>**Producers are the registry:** explicit `@Produces` methods in a composition module construct cells with their capabilities — the hand-written switch in CDI clothing:</item>
    </list>
    <fence lang="java" p="6">@ApplicationScoped
public class SolverProducer {
    @Produces @ApplicationScoped
    DepSolver depSolver(AppConfig cfg, DepProvider p, Clock clock) {
        return switch (cfg.solver()) {        // R-001 at the seam
            case SAT   -&gt; new SatDepSolver(p, clock);
            case NAIVE -&gt; new NaiveDepSolver(p);
        };
    }
}</fence>
    <list ordered="false" p="7">
      <item>**Bean discovery mode `annotated`** (explicit `beans.xml`), never `all` — implicit-bean archaeology is the CDI form of component scanning and is banned for the same reason.</item>
      <item>**MicroProfile Config is the runtime flag tier, with provenance built in:** ConfigSources are *ordinal-ordered* (system props &gt; env &gt; files &gt; defaults) — the platform ships the Discipline's provenance chain natively; flags resolve once into a config record at the composition root, `@ConfigProperty` field-sprinkling in domain code is banned.</item>
    </list>
  </section>
  <section id="boundary" title="§4&apos; — boundary machinery">
    <list ordered="false" p="8">
      <item>**Fault-tolerance annotations (`@Retry`, `@CircuitBreaker`, `@Timeout`, `@Fallback`) are interceptors** — hidden control flow under R-021 — and live only on boundary/orchestration beans. If a retry policy is *domain* behavior, the cell implements it explicitly against its clock capability, testable without a container.</item>
      <item>**JPA entity quarantine:** entities are proxy-laden, lazily-loaded, lifecycle-managed objects — citizens of the second language. **Entities never cross into cells**; persistence sits behind repository seams returning records, mapping done in the adapter. The N+1 problem, detached-entity traps, and dirty-checking surprises all stay in the ring built to contain them.</item>
      <item>JAX-RS resources, servlets, messaging listeners: boundary adapters that parse (DTO → validation → domain types), call seams, translate sealed results to protocol responses with the REQ URI rendered on errors (PROP-014 §2.6). Health (`mp-health`) and metrics (`mp-metrics`/Telemetry) are boundary exports.</item>
    </list>
  </section>
  <section id="risks" title="§8&apos; — additional risk rows">
    <table p="9">
      <tr>
        <td>Footgun</td>
        <td>Rule</td>
        <td>Tier</td>
      </tr>
      <tr>
        <td>`@Inject`/scope/interceptor annotation inside a cell</td>
        <td>§1'</td>
        <td>ArchUnit</td>
      </tr>
      <tr>
        <td>bean discovery mode `all`</td>
        <td>§1'</td>
        <td>T-lex (descriptor)</td>
      </tr>
      <tr>
        <td>vendor package import outside boundary-of-boundary</td>
        <td>§0</td>
        <td>ArchUnit</td>
      </tr>
      <tr>
        <td>JPA entity in a seam signature or inside a cell</td>
        <td>§4'</td>
        <td>ArchUnit</td>
      </tr>
      <tr>
        <td>fault-tolerance annotation on domain logic</td>
        <td>§4'</td>
        <td>T-syn</td>
      </tr>
      <tr>
        <td>`@ConfigProperty` outside the composition root</td>
        <td>§3'</td>
        <td>T-syn</td>
      </tr>
      <tr>
        <td>second-implementation drift (vendor-only API creep)</td>
        <td>§0</td>
        <td>build diff</td>
      </tr>
    </table>
    <p p="10">**Overlay note.** The platform already believes in specs, implementations, and conformance kits; this overlay only asks the application to live up to its own runtime's governance model. The framework-free-core test from the Spring overlay applies verbatim: cells compile without `jakarta.*` on the classpath.</p>
  </section>
</spec>
