Seam-Guice is now part of Seam

Google Guice support for Seam is now part of the Seam distribution!

It is available since the 2.1.2 release of Seam, as a part of the IoC module, but if you happen to need it, the best choice is to grab the latest 2.2.0.GA version which includes a fix for the disinjection issue.

Disinjection

The problem with disinjection was that the implementation injected values to the fields annotated with @Inject, but did not clear those values after the method call. The disinjection step here is required for exactly the same reason that Seam itself performs it on @In- and @Out-jected fields – to prevent a long-scoped Seam component from holding a reference to a (possibly short-living) Guice component.

Also, the presence of disinjection allows you to @Inject non-serializable properties into serializable components without having to worry about making those properties transient.

Configuration and Docs

The configuration did not change, except for one detail, which is the “guice” namespace URL declaration in the components.xml file:

All components are now in the org.jboss.seam.ioc.guice package.

If you feel like checking the latest documentation of the Seam-Guice module, here is the link:
http://docs.jboss.com/seam/2.2.0.GA/reference/en-US/html/guice.html.

Thanks to Dan Allen who reviewed my code and spotted the disinjection issue.

-Pawel

Advertisements