Dependency injection can occur in a variety of ways, for example, via a setter method or a class variable.
依赖性的引入可以以多种方式出现,例如,通过设置属性值的方法或者类变量。
Take a look at the dependency graph for a typical setup of a component with two dependencies and the method parameters used (see Figure 1).
请看下图,这是典型的组件设置的依赖关系图,其中有两个依赖关系并使用了方法参数(参见图1)。
Dependency injection can occur in a variety of ways, such as through a setter method or a class variable.
依赖项注入可以通过多种方式进行,例如通过setter方法或类变量。
应用推荐