applicationScoped Bean を注入しようとしています。JSF2 ApplicationScope Bean インスタンス化時間で同様のトピックを見つけましたか? 任意のサーブレット関連クラスで JSF マネージド Bean を名前で取得する
顔のコンテキストでjsfの方法を使用すると、すべて問題ありません(WebsitesControllerはAppScopedです):
FacesContext context = FacesContext.getCurrentInstance();
WebsiteController websitesController = context.getApplication().evaluateExpressionGet(context, "#{websitesController}", WebsitesController.class);
2 つのオーバーフロー スレッドのインジェクションでは機能しません。私のコード:
@ManagedBean(eager=true)
@ApplicationScoped
public class WebsitesController implements Serializable {
...}
そして今私は試しました
@ManagedBean(name = "shopController")
@ViewScoped
public class ShopController {
{Injection-Statement}
private WebsitesController websitesController;
次のステートメントを試しました:
@ManagedProperty("#{websitesController}")
@Inject
@EJB
私のせい?