processAfterInitialization method
Processes the pod after all initialization callbacks have completed.
This method is called after all @PostConstruct methods and initialization-aware
interface callbacks have been invoked. The pod is fully initialized and ready for use.
Use Cases
- Final validation of initialized state
- Registration with external systems
- Starting background tasks or schedulers
- Cache warming or preloading
Parameters
@param pod The fully initialized pod instance @param podClass The class metadata of the pod @param name The name of the pod in the container @return The pod instance to use (original, wrapped, or null)
Example:
@override
Future<Object?> processAfterInitialization(Object pod, Class podClass, String name) async {
if (pod is ScheduledTask) {
await pod.startScheduler();
}
return pod;
}
Implementation
@override
Future<Object?> processAfterInitialization(Object pod, Class podClass, String name) async {
final proxyClass = podClass.getSubClasses().find((cls) => cls.getName().startsWith(Constant.PROXY_IDENTIFIER));
if (proxyClass != null) {
final newInstance = proxyClass.getDefaultConstructor()?.newInstance({}, [pod]);
if (newInstance != null && newInstance is Interceptable) {
newInstance.support = getMethodInterceptorDispatcher() ?? this;
return newInstance;
}
}
if (pod is Interceptable) {
pod.support = getMethodInterceptorDispatcher() ?? this;
}
return pod;
}