LLMpediaThe first transparent, open encyclopedia generated by LLMs

JSR 342

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: WildFly Hop 5
Expansion Funnel Raw 1 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted1
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
JSR 342
TitleJSR 342
StatusFinal
Release2011
PlatformJava Platform, Standard Edition
Spec leadAlex Buckley
RelatedJava EE, Java SE, JCP

JSR 342 is a Java Specification Request that defines an enhancement to the Java platform to introduce a programmatic injection framework and context lifecycle for modular applications. It was developed within the Java Community Process alongside inputs from Oracle, Sun Microsystems, Red Hat, and IBM, and it influenced subsequent revisions of Java EE, GlassFish, JBoss, and WildFly. The specification aimed to unify dependency injection patterns across Jakarta EE, JavaServer Faces, and enterprise frameworks, aligning with precedents set by earlier specifications and industry frameworks.

Background and Purpose

The initiative for this specification emerged from coordination among the Java Community Process, Oracle Corporation, Red Hat, and IBM to address gaps left by earlier standards and to harmonize approaches used by frameworks such as Spring, Google Guice, and Apache DeltaSpike. Stakeholders including the Eclipse Foundation, Apache Software Foundation, and BEA Systems contributed use cases drawn from enterprise applications, JavaServer Faces, and servlet containers. The charter emphasized compatibility with Java EE, Java SE, and OSGi environments to support deployments on GlassFish, JBoss, WebSphere, and Tomcat.

Specification and Key Features

The specification defines a type-safe dependency injection model, contextual lifecycle management, and an extensible interceptor and decorator model. It formalizes scopes, qualifiers, producers, disposers, and portable extensions comparable to features in Spring, Guice, and CDI-like models used in frameworks such as Seam and Deltaspike. It also provides integration points for JavaServer Faces, EJB, JAX-RS, and servlet technologies to enable managed beans to participate in request, session, and application lifecycles across GlassFish, JBoss, and WebLogic.

API and Technical Details

The API introduces annotations, interfaces, and metadata contracts enabling injection of beans by type and qualifiers, a programmatic API for obtaining references, and SPI hooks for portable extensions. It specifies lifecycle callbacks, contextual storage semantics, and interception priorities modeled to interoperate with AOP frameworks and interceptor stacks in servers like WildFly and WebSphere. The contract includes bootstrap rules for use in Java SE and embedding scenarios used by Spring Boot and OSGi runtime environments.

Implementations and Reference Implementation

Reference implementations and compatible implementations were produced by organizations including Oracle (GlassFish), Red Hat (JBoss/WildFly), and Apache-aligned projects. These implementations provided integrated support for managed beans, interceptor resolution, and deployment descriptor integration in application servers such as GlassFish, WildFly, WebSphere, and Tomcat distributions. Community projects like Apache DeltaSpike and Google Guice-inspired adapters offered portable extensions and bridging modules for integration with Play Framework and Dropwizard.

Adoption and Impact

Adoption occurred across enterprise platforms, middleware vendors, and open source frameworks, influencing Jakarta EE platform evolution and the design of subsequent dependency injection models. Vendors such as Oracle, Red Hat, IBM, and Payara integrated the model into server distributions used by enterprises running on Linux, Windows Server, and Solaris. The specification informed best practices adopted by JavaServer Faces, JAX-RS implementations, and microprofile-style initiatives, shaping container behavior in GlassFish, JBoss EAP, and Liberty runtimes.

Compatibility and Migration

Migration guidance addressed interoperability with earlier dependency injection patterns used in Spring, Guice, and legacy EJB models, providing compatibility layers and adapter strategies for gradual migration. Tools from vendors and community projects offered migration utilities for projects originally built on Spring, Seam, or custom injection containers when moving to Jakarta EE-compliant servers. The specification defined backward-compatible bootstrap semantics and extension points to ease transition for application codebases deployed on older GlassFish and WebLogic versions.

Security Considerations

Security considerations cover injection-related attack vectors, access control interactions with container-managed security in application servers like WebSphere and WildFly, and serialization concerns for contextual instances. The specification mandates constraints on reflective access, classloader interactions in OSGi and servlet containers, and explicit requirements for containment of extension code to prevent elevation-of-privilege scenarios. Implementers and operators are advised to follow vendor guidance from Oracle, Red Hat, and IBM for secure configuration in production deployments.

Category:Java Specification Requests