From SiA, section 6.2.3:
happen if a request-scoped variable were to be injected into a session-scoped object
via static DI? Recall that static DI occurs only once: when the object is created. In this
situation, as the request-scoped variable changes between HTTP requests, the sessionscoped
object retains the original value of the request-scoped variable and never gets
updated. This describes the behavior of most other IoC containers in existence today.
By using Seam’s dynamic DI, the same property on a session-scoped component would
always reflect the value of the request-scoped variable from the current request
because the injection is reapplied each time the component is invoked. Additionally,
the value isn’t retained beyond the end of the request since Seam breaks the reference
by disinjecting the value once the method call is complete.
IIRC, @Inject is used in Weld/EE6 apps and it's static injection on objection instantiation (similar to Spring's constructor injection).
So what happens in the above scenario? The request-scoped values that are injected will be stale in the session-scoped component? Is that true in Weld and what is the workaround if so?
Resolving and injection does happen on instantiation but there is an important distinction in what is injected. Normal scoped (request, session etc) beans use proxies. When a method on this proxy is used, it first looks up the true instance from the context and then executes on this instance.