Expand description
Launch contract.
Boot phases (executed strictly in this order — order matters):
- Collect inventory-registered providers + routes.
- Run each plugin’s
on_initwith a mutableArclyPluginContext— plugins may queue providers (provide<T>), routes, global interceptors, OpenAPI mutators. - Apply queued provider closures to the
DiContainerBuilder. - Freeze. The container becomes
&'static, lock-free for reads. - Build the OpenAPI spec, run plugin spec-mutators, leak it as
&'static. - Mount macro-registered routes, then plugin-registered routes.
- Bind the listener.
- Run each plugin’s
on_start(&container)— background tasks spawn here. - Serve. Ctrl-C / SIGTERM triggers axum’s graceful shutdown — accepts
stop, in-flight drain. Only after that completes do plugin
on_shutdown(&container)calls run, wrapped in a 5-second timeout so a wedged plugin can never wedge the process.