Weld 1.0.1 Runs on GAE

DZone 's Guide to

Weld 1.0.1 Runs on GAE

· Java Zone ·
Free Resource
In the last 24 hours, the Weld team at JBoss has pushed out a full distribution of the second candidate release for Weld 1.0.1.  Weld is the open source JBoss reference implementation of the Contexts and Dependency Injection ( CDI) specification, which was approved only a few months ago along with the Java EE 6 spec.  The first 1.0.1 candidate release was only published as artifacts to the Maven Central Repository, but CR2 is the first Weld 1.0.1 release in the form of a full distribution.  Even though it's a tiny version number change, Weld 1.0.1 includes some significant new features like support for running on Google App Engine, stronger Java SE support, and the improved CDI TCK (Technology Compatibility Kit).

GAE Support
In addition to many bug fixes and major memory usage improvements, Weld 1.0.1 now has basic support for running on Google App Engine's scalable infrastructure.  This support was made possible with the help of the Weld community, which identified the patch assumptions that prevented Weld from running on GAE.  Moving forward, the Weld developers will look for more outstanding conflicts and resolve them in order to make Weld go beyond just basic support.  If you're anxious to get started, there's a demonstration already posted on the JBoss blog that shows developers how to avoid certain pitfalls and get their CDE + JSF 2 applications up and running on GAE.  The post is the first part of a GAE tutorial series that will take developers through App Engine signup, installing the GAE SDK plugin for Eclipse, managing required CDI and JSF libraries and configurations, and then deployment.  You can go see the an example of the Weld numberguess application on appspot for proof of this support.

Weld SE
JBoss says that the Java SE support is what really sets Weld apart from other CDI RIs like Resin CanDI and Apache OpenWebBeans.  In Weld 1.0.1 CR2, several improvements have been made to the Java SE support.  Now there is documented support for interceptors and decorators along with a refactoring to use the standard BeforeShutdown event.  The Weld team says the most noticeable improvement in the Java SE support is the simplification of the bootstrap API ( new Weld()).  Example below:
Weld weld = new Weld().initialize();
weld.event().select(Bar.class).fire(new Bar());

Version 1.0.1 will now include the CDI TCK, which has gotten a lot of improvements recently thanks to the Apache OpenWebBeans team.  By resolving deficiencies such as broken tests and invalid spec interpretations, the CDI TCK has become much more robust.  

Weld is included in JBoss AS 6 and Glassfish v3 (and in WebProfile development).  For JBoss AS users on the bleeding edge (version 6 M2), AS 6 snapshots will allow you to get the Weld 1.0.1 CR2 out of box experience.  Another option is to update the JBoss AS 6 installation using the following command from the root of the Weld distribution:

JBOSS_HOME=/path/to/jboss-as-6 mvn -f jboss-as/pom.xml

Here is a list of benefits that CDI offers:
  • Improved lifecycle for stateful objects, bound to well-defined contexts
  • A typesafe approach for dependency injection
  • Object interaction through an event notification facility
  • A better method for binding interceptors to objects
  • A new interceptor that is more appropriate for use in solving business problems, called a decorator
  • An SPI for building portable extensions to the container.

CR2 is now available for the final inspection stage.  The Weld team would like as much feedback from the open source community as possible before the final release of Weld 1.0.1 on February 19th.  Moving forward, the Weld team plans on building the next version of Weld (1.0.2) over the next three months, focusing on performance, scalability, and bug fixes.  They will also be shifting some of the team's focus to Seam 3 development.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}