Generated by GPT-5-mini| JSR 330 | |
|---|---|
| Title | JSR 330 |
| Other names | Dependency Injection for Java |
| Status | Final |
| Release | 2005 |
| Authors | Rod Johnson, Martin Fowler, Eric Evans |
| Related | Java Platform, Java Community Process, OSGi |
JSR 330
JSR 330 is a Java specification request that defines a standard set of annotations and interfaces for dependency injection for the Java platform, aligning with efforts from the Java Community Process, Spring Framework, and Google Guice to simplify component wiring and inversion of control in enterprise and modular applications. The specification influenced frameworks and projects across the Java ecosystem, including implementations in application servers, build tools, and runtime containers, and intersected with standards bodies and open source initiatives such as the Apache Software Foundation, Eclipse Foundation, and OSGi Alliance.
The proposal for this specification emerged amid discussions involving the Java Community Process, Oracle, Sun Microsystems, and influential practitioners like Rod Johnson, Brian Goetz, and Martin Fowler who had shaped patterns in enterprise Java through projects such as Spring Framework, Hibernate, and Apache Struts. Interest from organizations including Google, Red Hat, IBM, and BEA Systems led to collaborative design reviews that considered precedents from Guice, PicoContainer, and Google Web Toolkit, as well as integration concerns with Java Enterprise Edition, JavaServer Faces, and Servlet containers.
The specification formalizes a compact API that introduces annotations and provider interfaces to support constructor, method, and field injection compatible with Java SE and Java EE runtimes such as JBoss, GlassFish, and Apache Tomcat. It specifies semantics for annotations, lifecycle, scoping, and metadata processing that relate to classloading in OSGi bundles, bytecode manipulation tools like ASM and Javassist, and deployment models used by Maven, Gradle, and Ant. The design was influenced by standards efforts at the Java Community Process and considerations from the Eclipse Foundation, Apache Software Foundation, and various vendor implementations.
Core concepts defined include injection points, qualifiers, scopes, and providers, with annotations that denote component constructors, producer methods, and lifecycle callbacks applicable in contexts such as JavaServer Pages, Enterprise JavaBeans, and CDI-managed beans. The annotation set interacts with metadata models and reflection utilities used in frameworks like Spring Framework, Google Guice, Apache OpenEJB, and Weld, and complements tooling from IntelliJ IDEA, Eclipse IDE, and NetBeans for annotation processing and code navigation.
Implementations were provided by multiple projects including Google Guice, Spring Framework, Weld, Dagger, and PicoContainer, while commercial and community application servers such as JBoss, GlassFish, WebLogic, and Apache Tomcat incorporated support. Third-party libraries and frameworks including Apache CXF, Jersey, Dropwizard, Play Framework, and Vert.x adapted interoperability layers, and build and CI systems like Jenkins, Hudson, TeamCity, Travis CI, and GitHub Actions included test harnesses to validate injection behavior across platforms like OpenJDK, Oracle JDK, and IBM J9.
The specification influenced architectural choices in large-scale systems developed by organizations such as Netflix, LinkedIn, Twitter, and Amazon, and affected educational curricula at universities and training programs from organizations like O’Reilly Media, Pluralsight, and Coursera. It shaped patterns in microservices architectures used with Docker, Kubernetes, and Spring Boot, and informed interoperability among projects hosted by the Apache Software Foundation, Eclipse Foundation, and Cloud Native Computing Foundation.
Critics from communities around Robert Martin, Uncle Bob, Martin Fowler, and others noted limitations related to runtime reflection costs, debugging difficulty, and potential for hidden dependencies that affect testability and static analysis tools such as FindBugs, SpotBugs, and SonarQube. Concerns raised by implementers at Red Hat, IBM, and Oracle included complexities integrating with modularity systems like OSGi and JPMS, and debates persisted about annotation proliferation versus external configuration approaches advocated by projects like Twelve-Factor App and infrastructure teams at Facebook and Google.
Category:Java specification requests Category:Software design patterns Category:Java (programming language)