我注意到@ApplicationScoped
注释仅用于errai文档中的模型/服务类。
我想知道是否可以将它与用户表面片段一起使用,例如@Templated
个文件?例如,我有一个小部件在许多@Page
上重复出现。我可以在@Inject注释中使用它的相同实例吗?
如果可以,我为什么会收到错误:
Uncaught Error: java.lang.IllegalStateException: This widget's parent does not implement HasWidgets
at FBf_g$.tC_g$ [as createError_0_g$] (Throwable.java:121)
at FBf_g$.DC_g$ [as initializeBackingError_0_g$] (Throwable.java:113)
at FBf_g$.mC_g$ (Throwable.java:67)
at FBf_g$.SC_g$ (Exception.java:29)
at FBf_g$.$C_g$ (RuntimeException.java:29)
at FBf_g$ (IllegalStateException.java:28)
at xkj_g$.LBe_g$ [as removeFromParent_0_g$] (Widget.java:204)
at xkj_g$ (TemplateWidget.java:43)
at Eij_g$ (TemplateUtil.java:251)
at mki_g$.yki_g$ [as createInstance_64_g$] (Type_factory__p_k_e_c_l_App__quals__j_e_i_Any_j_e_i_Default.java:652)
at mki_g$.xki_g$ [as createInstance_2_g$] (Type_factory__p_k_e_c_l_App__quals__j_e_i_Any_j_e_i_Default.java:622)
at rvi_g$.Wui_g$ [as createNewUnproxiedInstance_0_g$] (AbstractContext.java:85)
at rvi_g$.Yui_g$ [as getActiveNonProxiedInstance_0_g$] (AbstractContext.java:78)
at wyi_g$.Dyi_g$ [as trySettingInstance_0_g$] (ProxyHelperImpl.java:53)
at wyi_g$.zyi_g$ [as getInstance_3_g$] (ProxyHelperImpl.java:42)
at Uki_g$.gmi_g$ [as unwrap_1_g$] (Type_factory__p_k_e_c_l_App__quals__j_e_i_Any_j_e_i_Default.java:75)
at Nvi_g$.Xvi_g$ [as getEagerInstance_0_g$] (ContextManagerImpl.java:72)
at Nyi_g$.Wyi_g$ [as init_13_g$] (SyncBeanManagerImpl.java:103)
at Nyi_g$.fzi_g$ [as setContextManager_0_g$] (SyncBeanManagerImpl.java:90)
at d7h_g$.e7h_g$ [as bootstrapContainer_1_g$] (Container.java:80)
at d7h_g$.g7h_g$ [as onModuleLoad_0_g$] (Container.java:40)
at Array.Y9d_g$ (pl_00046korbeldaniel_00046erpe_00046App__EntryMethodHolder.java:3)
at initializeModules_0_g$ (ModuleUtils.java:44)
at Fcc_g$ (Impl.java:239)
at Icc_g$ (Impl.java:298)
at Impl.java:77
at q9d_g$ (ModuleUtils.java:55)
at MenuEntryWidget.java:43
每次我向@ApplicationScoped
小部件类添加@Templated
注释?
答案 0 :(得分:0)
根据我的经验,您无法将@ApplicationScoped
用于@Templated
窗口小部件,@EntryPoint
也可以是@Templated
嘿,这是一个例子:
@ApplicationScoped
@Templated
@EntryPoint
public class App extends Composite {
}