This content has been marked as final.
Show 2 replies
-
1. Re: How should i do if i want to use a job to access @RequestScoped bean
mkouba Sep 23, 2013 4:45 AM (in response to wguo)1 of 1 people found this helpfulHi,
you'll have to activate/deactive the request context manually. The CDI spec does not define any portable way for manipulating contexts so you will have to use Weld API (there's an example in Weld docs, 19.1. Managing the built in contexts: http://docs.jboss.org/weld/reference/latest/en-US/html/contexts.html#d0e5607). If working with Java SE, DeltaSpike ContainerControl module might be the best way (makes use of Weld API under the hood). You may also have a look at cdiqi - a simple prove of concept for Quartz Scheduler CDI integration (it supports request context during job execution).
-
2. Re: How should i do if i want to use a job to access @RequestScoped bean
wguo Sep 24, 2013 1:52 AM (in response to mkouba)Thanks Martin , i will try it .