I try to inject a applicationScoped Bean. I found similar topics at JSF2 ApplicationScope bean instantiation time? and Get JSF managed bean by name in any Servlet related class
With the jsf way in faces context all is fine (WebsitesController is AppScoped):
FacesContext context = FacesContext.getCurrentInstance();
WebsiteController websitesController = context.getApplication().evaluateExpressionGet(context, "#{websitesController}", WebsitesController.class);
With the injections of the two overflow threads it doesn't work. My Code:
@ManagedBean(eager=true)
@ApplicationScoped
public class WebsitesController implements Serializable {
...}
and now i tried
@ManagedBean(name = "shopController")
@ViewScoped
public class ShopController {
{Injection-Statement}
private WebsitesController websitesController;
I tried following statements:
@ManagedProperty("#{websitesController}")
@Inject
@EJB
Whats my fault?