What do you think is the best way to implement a JSF managed bean concerning session scope versus request scope? In my case I have a EAR application with a EJB module and a web module. The EJB module provides stateless session beans. In the Web module now I am using a ManagedBean in sessionScope. This bean injects some of the staeless session ejbs and holds some value objects containing business data which can be used in different pages.
@Named("workflowController")
@SessionScoped
public class WorkflowController {
private List<ItemCollection> someList;
private ItemCollection someBusinessData;
/* Services */
@EJB
private MyService myService;
The bean provides a lot of action methods for the frontend and makes use of the stateless session bean. Is this general good practise? Or should I change my controller to request scope? I have seen projects where the frontend controller is used only in RequestScoped and injects all the business Data objects as managedProperties which are implemented as ManagedBeans in SessionScope.
In my example I have only one controller in SessionScope holding all business values and providing business methods implemented in stateless ejbs. In the other case one controller is used in RequestScopde and there are a lot of BusinessValue objects implemented as MangedBeans in SessionScope which are injected into the controller bean.
My question is: Is it bad practice to inject Session EJBs into a SessionScope Managed bean in general?