The initialization code in Listing 2 is part of a class that uses setter injection for DI.
清单2中的初始化代码是一个类的一部分,它使用setter注入进行DI。
To facilitate this setter injection, I've registered set methods for both my properties.
为了方便这个setter注入,我为两个属性都注册了set方法。
PicoContainer's prevailing usage model is constructor injection, although it also supports setter injection.
PicoContainer 流行的使用模型是构造函数注入,但它也支持setter 注入。
The EJB 3.0 specification talks about public field injection and setter injection, but constructor injection will enable you to avoid creating setters for values you don't expect to change.
EJB 3.0规范谈到了公共字段注入和setter注入,但构造器注入将使您可以避免为预期不会更改的值创建setter。
Two major schools of thought revolve around how to perform DI: constructor injection and setter injection.
围绕着如何执行DI,主要有两派思想:构造函数注入和setter注入。
Spring supports three types of dependency injection — setter, constructor, and method injection — but overall, the prevailing model is setter injection.
Spring支持三种依赖注入——setter、构造函数和方法注入——但总的来说,最流行的模型是setter注入。
HiveMind users typically prefer setter injection, but the container also supports constructor injection.
HiveMind用户通常优先选择setter注入,但该容器还支持构造函数注入。
Like Spring, Pico also supports setter injection, but the emphasis is strongly on constructors.
类似Spring,Pico也支持setter注入,但主要使用构造函数。
The alternative (and more widely used) behavior is setter injection, where dependent classes are injected through set methods.
另一种(也是使用更广的)行为是setter注入,在这种注入中,通过set方法注入依赖类。
The customer class shown in Listing 3 is a good example of a class that USES setter injection.
清单3所示的customer类是使用setter注入的类的良好示例。
Listing 4 shows what the CustomerFinder interface would look like if setter injection were used instead.
清单4显示了使用setter注入时CustomerFinder接口的样子。
Dependency injection can occur in a variety of ways, for example, via a setter method or a class variable.
依赖性的引入可以以多种方式出现,例如,通过设置属性值的方法或者类变量。
Setter injection injects types through set() methods.
Setter注入通过set() 方法注入类型。
Dependency injection can occur in a variety of ways, such as through a setter method or a class variable.
依赖项注入可以通过多种方式进行,例如通过setter方法或类变量。
Type 2 or setter injection, in which the dependent module exposes a setter method which the framework USES to inject the dependency.
类型2设置器注入,使用者暴露一个设置器方法,框架将使用此方法注入依赖项。
Type 2 or setter injection, in which the dependent module exposes a setter method which the framework USES to inject the dependency.
类型2设置器注入,使用者暴露一个设置器方法,框架将使用此方法注入依赖项。
应用推荐