跳到主要内容

Dependcy Injection

Dependency Injection (DI) is a technique used in software development to manage dependencies between different components or classes. It involves providing dependencies to a class from the outside, rather than the class creating them internally. This enhances flexibility, testability, and maintainability of the code.

提示

Dependency Injection is a crucial design pattern in developing complex applications. It is essential for you to master it.

Wire

Wire is a code generation tool that automates connecting components using dependency injection. Dependencies between components are represented in Wire as function parameters, encouraging explicit initialization instead of global variables. Because Wire operates without runtime state or reflection, code written to be used with Wire is useful even for hand-written initialization.

Wire is popular and recommended by Kratos, but there are some missing features.

So we choose the next one:

defval/di