The traditional way to integrate JSF and Spring was to define JSF beans in faces-config as managed beans and refer to the spring beans using the managed-property configuration. With the help of the spring’s delegatingvariableresolver the managed property is resolved from spring application context and JSF’s IOC injects the bean to the JSF Managed bean instance. I’ve written an article it about this way before.First approach is modelled as follows
JSF-Spring-JPA is the popular stack of choice these days, mostly to be used in my consulting and training purposes I’ve created a base project called MovieStore demonstrating the annotation-driven integration of JSF-Spring-JPA. JSF backing beans, spring service level beans and DAO’s are configured and integrated with annotations. Only the core infrastructure like datasource, entityManagerFactory or transactionManager are configured with xml.
this module makes the integration of spring-annotation and JSF really easy.
* It registers automatically a VariableResolver in the JSF stack to enable the use of the spring beans as managed beans
* it adds 2 (two) more scopes to spring framework: flash and conversation
* it registers a navigation handler in the JSF stack to enable you to write less code
* it adds some annotations to make it easier to write JSF code
Apache MyFaces Orchestra aims to provide a simple way to combine a web-framework with a persistence layer. Typically, an Apache MyFaces Orchestra stack might combine JavaServer Faces, Spring and a JPA implementation like Toplink, Hibernate, etc.
The underlying idea is to provide long persistence sessions to the web-developer - this is done by associating these sessions with a conversational context.
The conversational context is opened when the bean configured for this context is first loaded. It can be manually closed by the programmer, plus a time-out can be configured as a global parameter.