Consider the following request-scoped CDI bean:
@RequestScoped
public class RequestScopedBean {
// ...
}
Now, I inject it in a application-scoped bean:
@ApplicationScoped
public class ApplicationScopedBean {
@Inject private RequestScopedBean requestScopedBean;
// ...
}
I ran this code and noted that the request-scoped bean instance is different between two requests but the application-scoped bean instance is the same. My doubt is: how does this work? Is the request-scoped bean instance reattributed to the application-scoped field at each request? Or the proxy of the application-scoped bean just changes between requests?
@ApplicationScoped
bean has a@SessionScoped
bean injected, and receives two parallel invocations from@RequestScoped
methods? – Alex