Hi Harald! After starting a new thread you must start a ReqeustContext for it manually.
There is not yet an API for it, but you can do this in a portable way with Apache DeltaSpike CdiControl. Just @Inject ContextControl ctxCtrl. and invoke ctxCtrl.startContext(RequestScoped.class); and it should work. LieGrue, strub ----- Original Message ----- > From: Harald Wellmann <[email protected]> > To: [email protected] > Cc: > Sent: Thursday, August 30, 2012 7:58 PM > Subject: Request context in Java SE > > In a multi-threaded Java SE application, how can I make sure that a CDI > request > context is started for every thread? > > As far as I can see, a request context is only available on the thread that > created the CDI container (WebBeansContext). > > Is there a portable way of starting the contexts (i.e without depending on > OWB > APIs)? > > If not, will this be addressed in CDI 1.1? > > Best regards, > Harald >
