cancel
Showing results for 
Search instead for 
Did you mean: 

Why having both JSF and Spring managed beans?

georgosn
Champ in-the-making
Champ in-the-making
From what I see in the deployed Alfresco (community edition 3.2r) there are both declarations in faces-config(lot of them) for managed beans and in spring-context.xml (lots of them). I haven't really made a match as to if Alfresco comes with doublication (same bean defined in spring and in jsf) but even if this is not the case, there is still a big question, Why do we need both? JSF can be, very very easily, configured to use spring for the managed beans. This would eliminate even the possibility of errors. Does anybody else see the problem or is it just my strict thinking mind here?

My involvement is limited in creating extensions to Alfresco (client applications) and in one of them, it seems that we need to have beans declared both in spring and in faces config (otherwise something is always missing).

Anyone has an answer?
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
In Alfresco Explorer you have two separated contexts: a context is dedicated to the JSF managed beans and an other context is dedicated to the Spring beans.
In Alfresco whenever you find the same bean declared in the JSF context, this means that there is a binding for all these beans. It means that you can invoke a Spring bean from the JSF context.

This is very useful, so you have the same declaration, but the spring bean is the same instance for that bean.
Alfresco provide us an utility class that allows you to invoke beans from the JSF context.

Hope this helps.