public ApplicationContext getApplicationContext ( final JobExecutionContext context ) throws JobExecutionException { SchedulerContext schedulerContext ; try { final Scheduler scheduler = context . getScheduler ( ) ; schedulerContext = scheduler . getContext ( ) ; } catch ( SchedulerException e ) { logger . error ( "Unable to retrieve the scheduler context, cause : " , e ) ; throw new JobExecutionException ( e ) ; } final ApplicationContext applicationContext = ( ApplicationContext ) schedulerContext . get ( APPLICATION_CONTEXT_BEAN_NAME ) ; return applicationContext ; }
Retrieves the spring application context from the job execution context .