initializeLifecycleProcessor method
- @protected
- @mustCallSuper
- ConfigurableListablePodFactory podFactory
Initializes the LifecycleProcessor for this context.
By default, it registers a DefaultLifecycleProcessor in the pod factory.
Subclasses can override to supply a different lifecycle strategy.
This is part of Jetleaf – a framework which developers can use to build web applications.
Implementation
@protected
@mustCallSuper
Future<void> initializeLifecycleProcessor(ConfigurableListablePodFactory podFactory) async {
if (await podFactory.containsLocalPod(LIFECYCLE_PROCESSOR_POD_NAME)) {
_lifecycleProcessor = await podFactory.getPod<LifecycleProcessor>(LIFECYCLE_PROCESSOR_POD_NAME);
if (logger.getIsTraceEnabled()) {
logger.trace("Using lifecycle processor ${_lifecycleProcessor!.runtimeType}");
}
} else {
final dlp = Class<DefaultLifecycleProcessor>(null, PackageNames.CORE);
final defaultLp = DefaultLifecycleProcessor(podFactory);
_lifecycleProcessor = defaultLp;
await podFactory.registerSingleton(
LIFECYCLE_PROCESSOR_POD_NAME,
Class<DefaultLifecycleProcessor>(),
object: ObjectHolder<LifecycleProcessor>(
defaultLp,
packageName: PackageNames.CORE,
qualifiedName: dlp.getQualifiedName(),
),
);
if (logger.getIsTraceEnabled()) {
logger.trace("No lifecycle processor found, using default lifecycle processor ${_lifecycleProcessor!.runtimeType}");
}
}
return Future.value();
}