Day 01 — CDI 4.0 Scopes, Contexts & Lifecycle Management¶
Daily Time Investment: 2.5 hours | Week: 1 | Phase: 3
Daily Schedule¶
| Segment | Duration | Activity |
|---|---|---|
| Core Theory | 45 min | @RequestScoped, @ApplicationScoped, @SessionScoped, @Dependent — scope proxying mechanics via bytecode generation |
| Book Reading | 30 min | EE8 AppDev — Chapter 5: Contexts and Dependency Injection |
| Hands-On Lab | 75 min | Multi-scoped bean hierarchy; proxy analysis via System.identityHashCode() |
Files in This Day¶
-
Book Summary — EE8 AppDev, Chapter 5
Deep summary of CDI: Named beans,
@Inject, qualifiers, scope lifecycle table, CDI events (@Observes,@ObservesAsync), event ordering. -
Lab Guide — CDI Scopes & Proxying
Build a multi-scoped bean hierarchy (
@ApplicationScoped,@RequestScoped,@Dependent) using Weld SE. Observe proxy class names, lazy instantiation, and scope boundaries.
Prerequisites to Continue¶
New concepts in Phase 3 not seen in Phase 1 or Phase 2
- Jakarta EE Container vs raw JVM — Phase 2 tuned the JVM directly; Phase 3 runs inside a managed container (WildFly, Payara, GlassFish) that wraps the JVM
- CDI BeanManager — the central registry managing contextual instances, injection point resolution, and event dispatch
- Weld SE — the JBoss Weld CDI reference implementation in standalone Java SE mode (no app server required for labs)
SeContainerInitializer— Jakarta CDI 4.0 API for bootstrapping Weld without an application serverbeans.xml— CDI bean archive marker file placed insrc/main/resources/META-INF/; can be empty or specifybean-discovery-mode="annotated"- Proxy bytecode generation — CDI containers use ByteBuddy / Javassist to generate subclasses at deployment time; conceptually the same as Phase 2's ByteBuddy work but done transparently