接口 AotContextLoader
- 所有超级接口:
ContextLoader,SmartContextLoader
- 所有已知实现类:
AbstractDelegatingSmartContextLoader,AbstractGenericContextLoader,AbstractGenericWebContextLoader,AnnotationConfigContextLoader,AnnotationConfigWebContextLoader,DelegatingSmartContextLoader,GenericPropertiesContextLoader,GenericXmlContextLoader,GenericXmlWebContextLoader,WebDelegatingSmartContextLoader
ApplicationContext for build-time
AOT processing as well as run-time
AOT execution for an integration test
managed by the Infra TestContext Framework.
AotContextLoader is an extension of the SmartContextLoader
SPI that allows a context loader to optionally provide ahead-of-time (AOT)
support.
AOT infrastructure requires that an AotContextLoader
create a GenericApplicationContext for both build-time processing and run-time execution.
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Harry Yang
-
方法概要
修饰符和类型方法说明cn.taketoday.context.ApplicationContextloadContextForAotProcessing(MergedContextConfiguration mergedConfig) Load a newApplicationContextfor AOT build-time processing based on the suppliedMergedContextConfiguration, configure the context, and return the context.cn.taketoday.context.ApplicationContextloadContextForAotRuntime(MergedContextConfiguration mergedConfig, cn.taketoday.context.ApplicationContextInitializer initializer) Load a newApplicationContextfor AOT run-time execution based on the suppliedMergedContextConfigurationandApplicationContextInitializer.从接口继承的方法 cn.taketoday.test.context.SmartContextLoader
loadContext, loadContext, processContextConfiguration, processLocations
-
方法详细资料
-
loadContextForAotProcessing
cn.taketoday.context.ApplicationContext loadContextForAotProcessing(MergedContextConfiguration mergedConfig) throws Exception Load a newApplicationContextfor AOT build-time processing based on the suppliedMergedContextConfiguration, configure the context, and return the context.In contrast to
SmartContextLoader.loadContext(MergedContextConfiguration), this method must not refresh theApplicationContextor register a JVM shutdown hook for it. Otherwise, this method should implement behavior identical toloadContext(MergedContextConfiguration).Any exception thrown while attempting to load an
ApplicationContextshould be wrapped in aContextLoadException. Concrete implementations should therefore contain a try-catch block similar to the following.GenericApplicationContext context = // create context try { // configure context } catch (Exception ex) { throw new ContextLoadException(context, ex); }- 参数:
mergedConfig- the merged context configuration to use to load the application context- 返回:
- a new
GenericApplicationContext - 抛出:
ContextLoadException- if context loading failedException- 另请参阅:
-
loadContextForAotRuntime
cn.taketoday.context.ApplicationContext loadContextForAotRuntime(MergedContextConfiguration mergedConfig, cn.taketoday.context.ApplicationContextInitializer initializer) throws Exception Load a newApplicationContextfor AOT run-time execution based on the suppliedMergedContextConfigurationandApplicationContextInitializer.This method must instantiate, initialize, and refresh the
ApplicationContext.Any exception thrown while attempting to load an
ApplicationContextshould be wrapped in aContextLoadException. Concrete implementations should therefore contain a try-catch block similar to the following.GenericApplicationContext context = // create context try { // configure and refresh context } catch (Exception ex) { throw new ContextLoadException(context, ex); }- 参数:
mergedConfig- the merged context configuration to use to load the application contextinitializer- theApplicationContextInitializerthat should be applied to the context in order to recreate bean definitions- 返回:
- a new
GenericApplicationContext - 抛出:
ContextLoadException- if context loading failedException- 另请参阅:
-