Trouble was in wrong annotation imports. You need to use annotation which are from javax.faces.bean package.
Managed Application scoped bean creates multiple times
سؤال
I have beans
@ManagedBean(name="HistoryBean")
@ApplicationScoped
public class HistoryBean
{...}
@ManagedBean(name="ViewBean")
@ApplicationScoped
public class ViewBean
{
public void setHistoryBean(HistoryBean historyBean)
{this.historyBean = historyBean;}
@ManagedProperty(value="#{HistoryBean}")
private HistoryBean historyBean;
}
I want to HistoryBean was created only once, but it creates on each request(?) with clean state. What did I do wrong?
المحلول
لا تنتمي إلى StackOverflow