Thread.currentThread().setContextClassLoader(classLoader);
if (logger.isDebugEnabled()) logger.debug("Setting class loader to " + classLoader);
ConfigurableApplicationContext context = moduleLoader.newApplicationContext(application, parent, definition, classLoader);
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
addBeanPostProcessors(application, definition, beanFactory);
final String applicationId = application.getId();
BeanDefinitionReader reader = moduleLoader.newBeanDefinitionReader(applicationId, context, definition);