Gavin King leads the Ceylon project at Red Hat. Gavin is the creator of
Hibernate, a popular object/relational persistence
solution for Java, and the Seam Framework, an
application framework for enterprise Java. He's contributed to the Java
Community Process as JBoss and then Red Hat representative for the EJB and
JPA specifications and as lead of the
Gavin now works full time on Ceylon, polishing the language specification,
developing the compiler frontend, and thinking about the SDK and future of
the platform. He's still a fan of Java, and of other languages, especially
Smalltalk, Python, and ML.
Today, Red Hat submitted the final draft of JSR-299, which now goes under the moniker CDI (Contexts and Dependency Injection), along with the Reference Implementation and TCK. Check out the spec and Javadoc.
Suppose we have an external resource, a database, let's say, that we want to be able to change depending upon the deployment environment. In CDI, we declare resources using a producer field declaration.
In my previous little rant, I showed you how to use @Alternative and alternative stereotypes to easily change bean implementations based upon deployment scenario. But that's not the end of the story. There's two other things I would sometimes like to be able to change at deployment time:
I'm trying really hard to emphasize to the community that CDI and Weld are not just a dependency injection solution. We did not come at this from the point of view of trying to solve dependency injection, or of trying to build a better Spring.
CDI (JSR-299) and Weld 1.0 are almost a reality. We've got word from Sun that CDI and the rest of Java EE 6 will be submitted to the JCP on November 9. I've spent the last few days filling out the Javadoc for the CDI API and SPI packages and making some last-minute cleanups to the spec. Meanwhile, Pete and the others are fixing bugs in the RI and TCK. This process has taken more than 3 years, and an incredible amount of pain, but we're now looking at one of the most well-reviewed JCP specifications ever.