Does CDI
allows pooling in some way?Because I thought this is a feature of EJB
beans but Adam Bien says in this screencast that container chooses whether to create new instance of class through reflection or use the existing one. So if I have for example these two beans
@RequestScoped
public class RequestBean {
public void doIt() {
}
}
@SessionScoped
public class SessionBean {
@Inject
private RequestBean bean;
public void doSomething() {
bean.doIt();
}
}
the question is - is there always new instance of RequestBean
created upon calling doSomething
or does CDI
container somehow manage instances in pool?