LoggerContextJobListener implements JobExecutionListener { @Override public void afterJob(JobExecution jobExecution) { MDC.remove(JOB_EXECUTION_ID); MDC.remove(JOB_INSTANCE_ID); }  @Override void beforeJob(JobExecution jobExecution); @Override void afterJob(JobExecution jobExecution); static final String JOB_EXECUTION_ID; static final String JOB_INSTANCE_ID; }
@Test public void testAfterJob() throws Exception { listener.beforeJob(jobExecution); listener.afterJob(jobExecution); Assert.assertNull(MDC.get(LoggerContextJobListener.JOB_EXECUTION_ID)); Assert.assertNull(MDC.get(LoggerContextJobListener.JOB_INSTANCE_ID)); }