我有一个 applicationScoped bean,我在其中初始化我的 Store。
@ManagedBean(name="applicationBean", eager=true)
@ApplicationScoped
public class applicationBean implements Serializable {
private Store store;
public applicationBean() {
store = new Store();
}
public Store getStore() {
return store;
}
}
现在我想把我的商店放在我的另一个 Bean 中。
@ManagedBean(name="productsBean")
@RequestScoped
public class ProductsBean implements Serializable {
private List <Product> products;
public ProductsBean(){
}
}
如何从我的 applicationScoped Bean 调用 getter?