I have an ApplicationScoped bean that I'd like to access in a quartz job implementation. That bean holds a hashmap through run-time and I'd like to populate the hashmap when the job runs. However, the FacesContext is out of context inside the job. I have access to the ServletContext. Is it possible to access my bean through the ServletContext?
My code to access the Servlet Context:
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    SchedulerContext schedulerContext=null;
    try {
        schedulerContext=context.getScheduler().getContext();
    }
    catch (SchedulerException e) {
        e.printStackTrace();
    }
    ServletContext servletContext=(ServletContext)schedulerContext.get("QuartzServletContext");
    BOCacheM bOCacheM = (BOCacheM) servletContext.getAttribute("bOCacheM");
}
My QuartzServletContext is defined in web.xml as:
<context-param>
    <param-name>quartz:scheduler-context-servlet-context-key</param-name>
    <param-value>QuartzServletContext</param-value>
</context-param>
<listener>
    <listener-class>
        org.quartz.ee.servlet.QuartzInitializerListener
    </listener-class>
</listener>
 
    