@Component public class ApplicationContextProvider implements ApplicationContextAware, BeanPostProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationContextProvider.class); private static ApplicationContext ctx; public static ApplicationContext getApplicationContext() { return ctx; } @Override @SuppressWarnings("static-access") public void setApplicationContext(ApplicationContext ctx) { System.setProperty("org.jboss.logging.provider", "slf4j"); if (this.ctx == null) { LOGGER.info("Setting app context = " + ctx); } else { LOGGER.warn("Refreshing app context; old = " + this.ctx + " New = " + ctx); } this.ctx = ctx; } }