public static IServiceContext CreateBootstrap(IProperties properties, Type[] bootstrapModules, params Object[] bootstrapModuleInstances) { if (properties == null) { properties = Properties.Application; } // create own sub-instance of properties Properties newProps = new Properties(properties); ThreadLocalCleanupController threadLocalCleanupController = new ThreadLocalCleanupController(); ConversionHelper conversionHelper = new ConversionHelper(); DelegatingConversionHelper delegatingConversionHelper = new DelegatingConversionHelper(); LinkController linkController = new LinkController(); LoggerHistory loggerHistory = new LoggerHistory(); AccessorTypeProvider accessorTypeProvider = new AccessorTypeProvider(); ExtendableRegistry extendableRegistry = new ExtendableRegistry(); GarbageProxyFactory garbageProxyFactory = new GarbageProxyFactory(); PropertyInfoProvider propertyInfoProvider = new PropertyInfoProvider(); BeanContextInitializer beanContextInitializer = new BeanContextInitializer(); CallingProxyPostProcessor callingProxyPostProcessor = new CallingProxyPostProcessor(); ProxyFactory proxyFactory = new ProxyFactory(); DelegateFactory delegateFactory = new DelegateFactory(); AutoLinkPreProcessor threadLocalCleanupPreProcessor = new AutoLinkPreProcessor(); callingProxyPostProcessor.PropertyInfoProvider = propertyInfoProvider; delegatingConversionHelper.DefaultConversionHelper = conversionHelper; linkController.ExtendableRegistry = extendableRegistry; linkController.Props = newProps; linkController.ProxyFactory = proxyFactory; beanContextInitializer.CallingProxyPostProcessor = callingProxyPostProcessor; beanContextInitializer.ConversionHelper = delegatingConversionHelper; beanContextInitializer.PropertyInfoProvider = propertyInfoProvider; garbageProxyFactory.AccessorTypeProvider = accessorTypeProvider; propertyInfoProvider.AccessorTypeProvider = accessorTypeProvider; threadLocalCleanupPreProcessor.SetExtendableRegistry(extendableRegistry); threadLocalCleanupPreProcessor.SetExtendableType(typeof(IThreadLocalCleanupBeanExtendable)); LoggerInstancePreProcessor loggerInstancePreProcessor = new LoggerInstancePreProcessor(); propertyInfoProvider.AfterPropertiesSet(); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, accessorTypeProvider); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, callingProxyPostProcessor); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, delegatingConversionHelper); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, extendableRegistry); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, linkController); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, loggerHistory); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, beanContextInitializer); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, propertyInfoProvider); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, threadLocalCleanupController); ScanForLogInstance(loggerInstancePreProcessor, propertyInfoProvider, newProps, threadLocalCleanupPreProcessor); accessorTypeProvider.AfterPropertiesSet(); callingProxyPostProcessor.AfterPropertiesSet(); delegatingConversionHelper.AfterPropertiesSet(); extendableRegistry.AfterPropertiesSet(); linkController.AfterPropertiesSet(); loggerHistory.AfterPropertiesSet(); beanContextInitializer.AfterPropertiesSet(); threadLocalCleanupController.AfterPropertiesSet(); threadLocalCleanupPreProcessor.AfterPropertiesSet(); PropertiesPreProcessor propertiesPreProcessor = new PropertiesPreProcessor(); propertiesPreProcessor.ConversionHelper = delegatingConversionHelper; propertiesPreProcessor.PropertyInfoProvider = propertyInfoProvider; propertiesPreProcessor.AfterPropertiesSet(); // The DelegatingConversionHelper is functional, but has yet no properties set propertiesPreProcessor.PreProcessProperties(null, null, newProps, "delegatingConversionHelper", delegatingConversionHelper, typeof(DelegatingConversionHelper), null, EmptySet.Empty <String>(), null); delegatingConversionHelper.AfterPropertiesSet(); BeanContextFactory parentContextFactory = new BeanContextFactory(linkController, beanContextInitializer, proxyFactory, null, newProps, null); parentContextFactory.RegisterWithLifecycle(loggerHistory).Autowireable <ILoggerHistory>(); parentContextFactory.RegisterWithLifecycle(proxyFactory).Autowireable <IProxyFactory>(); parentContextFactory.RegisterWithLifecycle(threadLocalCleanupController).Autowireable(typeof(IThreadLocalCleanupController), typeof(IThreadLocalCleanupBeanExtendable)); parentContextFactory.RegisterExternalBean(delegatingConversionHelper).Autowireable(typeof(IConversionHelper), typeof(IDedicatedConverterExtendable)); parentContextFactory.RegisterWithLifecycle(accessorTypeProvider).Autowireable <IAccessorTypeProvider>(); parentContextFactory.RegisterExternalBean(loggerInstancePreProcessor).Autowireable <ILoggerCache>(); parentContextFactory.RegisterWithLifecycle(extendableRegistry).Autowireable <IExtendableRegistry>(); parentContextFactory.RegisterWithLifecycle(garbageProxyFactory).Autowireable <IGarbageProxyFactory>(); parentContextFactory.RegisterWithLifecycle(callingProxyPostProcessor).Autowireable <CallingProxyPostProcessor>(); parentContextFactory.RegisterWithLifecycle(propertyInfoProvider).Autowireable <IPropertyInfoProvider>(); parentContextFactory.RegisterWithLifecycle(delegateFactory).Autowireable <IDelegateFactory>(); if (bootstrapModules != null) { for (int a = 0, size = bootstrapModules.Length; a < size; a++) { parentContextFactory.RegisterBean(bootstrapModules[a]); } } if (bootstrapModuleInstances != null) { for (int a = 0, size = bootstrapModuleInstances.Length; a < size; a++) { parentContextFactory.RegisterExternalBean(bootstrapModuleInstances[a]); } } List <IBeanPreProcessor> preProcessors = new List <IBeanPreProcessor>(); preProcessors.Add(propertiesPreProcessor); preProcessors.Add(loggerInstancePreProcessor); preProcessors.Add(threadLocalCleanupPreProcessor); return(parentContextFactory.Create("bootstrap", null, preProcessors, null)); }