JSF Spring Binding Overview


Over the last year the so called Spring Framework has gained huge momentum in many industry projects. The reason for this is, that it is a lightweight framework which can be easily integrated into projects without sacrification of the legacy code. The benefits are, that it adds AOP mechanisms, and transaction control as well as remoting interfaces very similar to the EJB 1+2 specs to every program without adding a huge overhead or complexity and without having the specialized needs for a separate EJB container.

At the current state of affairs, the author of this page has encountered the usage of Spring in several industry projects, therefore it can be assumed that this library has become very popular over the last year. The adoption rate within seemed to be very fast.

However with Seam and EJB3.0 there will be very similar libraries which try to solve the issues raised and solved by Spring in different manners, building upon the not yet finalized EJB3.0 spec and also omitting lots of overhead of EJB2.0 as well as not having to be embedded into a specialized EJB container.

Seam has its own page, this page is dedicated towards Spring and the integration into MyFaces.


Currently there are three ways to integrate JSF and spring, one is the JSF Spring integration from spring itself. The documentation can be looked up at the [http://www.springframework.org Spring Framework website].

This integration is very basic ans uses a variable resolver so that Spring beans become accessible from within the faces-config, but not the other way around. At the time of writing this option has not been tested by the Author, but it is very likely that this option is only from spring to jsf a call of a jsf bean within a spring application context is probably not possible. However for further reference and documentation. The Spring documentation has an entire chapter devoted to this integration library.

The other one, is the rather undocumented but excellent Spring-JSF Integration library hosted at sourceforge sourceforge. This library can be added very unintrusive and should allow calling of backend beans from the Spring Context and calling of spring beans from the Faces Context.

The configuration however is rather undocumented and the order at which the filters have to be added is important, this page, is intended to give some examples on how to properly setup this library in conjunction with MyFaces. Currently ony examples for myfaces 1.0.9 are shown for later versions config files will be added in the near future. The configuration files can be found on the JSF_Spring_Config page.

The third option, a very interesting option indeed is the jacn integration library on [http://jacn.sourceforge.net/ jsf-spring jacn integration library on sourceforge]. This library also uses the variable resolver approach but tries to omit the xml configuration files of spring in favor of pure java classes. There are interesting sideprojects going on within this library trying to solve the entire scoping issue in a Seam like manner. At the time of writing however no finalized code on this has been released, the developement currently is in an ongoing state.

jsf-spring (last edited 2009-09-20 23:00:39 by localhost)