依赖注入 -- class litestar.di.Provide¶ 基类:object 依赖注入的包装类 __init__(dependency: AnyCallable | type[Any], use_cache: bool = False, sync_to_thread: bool | None = None) → None¶ 初始化 Provide Args: dependency: 要调用的可调用对象或要实例化的类。其结果将被注入为依赖项。 use_cache: 缓存依赖项的返回值。默认为 False。 sync_to_thread: 在异步线程中运行同步代码。默认为 False。 async __call__(**kwargs: Any) → Any¶ 调用提供者的依赖项。