Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Weld Chugging Along

DZone's Guide to

Weld Chugging Along

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

The first beta for the next version of JBoss' Weld is here.  It has been approximately six months since JBoss released Weld 1.0.1, which added support for running on Google AppEngine.  The new beta for Weld 1.1 features about 60 bugfixes and new EJB 3.1 features.

Weld 1.1, the reference implementation of JSR-299: Contexts and Dependency Injection is based on the CDI 1.0 API.  Weld is being integrated into the JBoss Application Server, and version 1.1 should be available in the next release of JBoss AS 6.0.  Until then you'll need to use a snapshot build of JBoss AS.  Weld is also used in GlassFish v3 and supports several servlet containers such as Tomcat and Jetty.

Here are some of the new features in Weld 1.1:

  • Weld has migrated to Google Guava from google-collections
  • New EJB 3.1 features displayed in the new Pastecode example
  • Improvements in error reporting
  • Better memory usage
  • Unsafe instantiators
  • A new proxy layer that doesn't suffer from the memory leaks in Javasssist
  • About 60 bugfixes

Weld 1.1 also has the ability to exclude classes from being scanned and then deployed as beans.  This is achieved by configuring the beans.xml for the bean archive being deployed.  beans.xml may be parsed outside of Weld.

Here's an example of the configuration:
<beans xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd
http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">

<weld:scan>
<!-- Don't include GWT support if GWT is not installed -->
<weld:exclude name="com.acme.gwt.**">
<weld:if-class-available name="!com.google.GWT"/>
</weld:exclude>
</weld:scan>

</beans>
Another way to use Weld is with Java SE.  There is also strong support for Weld in the emerging Arquillian testing framework, which allows you to test in Weld SE, Tomcat, Jetty, JBoss AS, GlassFish, or a mocked out Java EE container.

You can find the 1.0.2 version of the CDI TCK here.

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}