You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2008/02/03 19:02:12 UTC

[Myfaces Wiki] Update of "JSF With Spring" by SimonKitching

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by SimonKitching:
http://wiki.apache.org/myfaces/JSF_With_Spring

New page:
The Spring framework (http://springframework.org) is a well-established and well-respected framework for dependency injection.

The JSF "managed beans" facility is a very simple implementation of the same sort of thing, but is missing a large number of Spring features.

JSF can be configured to use Spring to manage beans, and this integration works very well, with absolutely no changes needed in the rest of a JSF application. Spring's power can add a lot of flexibility to developing JSF applications.

Spring version 1.x did not have the ability to declare objects as having request or session scope, so could not be used as a complete replacement for the JSF "managed beans" facility. Spring could be used to inject data into managed beans, but the "top level" beans had to be declared in the faces-config files.

However Spring 2.x does support request and session scopes, and so can be used as a complete replacement for JSF managed bean declarations. 

There are several excellent tutorials on this written by Catagay Civici:
 * For Spring 2.5: http://cagataycivici.wordpress.com/2007/12/19/annotate-jsf-beans-with-spring-25/
 * For Spring 2.0: http://cagataycivici.wordpress.com/2007/09/10/using-spring-to-manage-jsf-beans/
 * For Spring 1.x: http://cagataycivici.wordpress.com/2005/12/25/integrating_jsf_and_spring/

There is also a rather old and obsolete page on this topic here:
 * http://wiki.apache.org/myfaces/JSF-Spring_and_JSF