这称为构造器注入。
OpenEJB还将支持构造器注入,从而使得容器可以在运行时提供各种类和对象。
OpenEJB will also support constructor injection, which enables the container to provide various classes and objects at run time.
毫无疑问,这些setter是框架所需的样板代码,如果不使用构造器注入也能避免这一点岂不美哉?
Again, these setters are framework induced boilerplate code. Wouldn’t it be nice if they could be avoided without the need to use Constructor injection everywhere?
EJB 3.0规范谈到了公共字段注入和setter注入,但构造器注入将使您可以避免为预期不会更改的值创建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.
在使用该方法时,我们必须记住该机制只支持访问器注入,不支持基于构造函数参数的注入。
While using this approach we have to remember that this mechanism supports only accessor-based injection, constructor argument based injection is not supported.
InfoQ:BobLee,Guice的创建者在介绍你的书的时候说对依赖注入的支持最终会成为另一个语言特征,“一个导入实例对象的构造器”。
InfoQ: Introducing your book Bob Lee, creator of Guice, says that DI support will eventually become just another language feature, "a construct for importing instances".
构造故障注入器是故障注入研究中的一个重要组成部分。
A major step in the research of fault injection is to construct a fault injector.
我们已经解决了依赖性问题:我们在运行时把依赖性注入到类的构造器之中。
We have resolved our dependency issue: we are going to inject our dependencies into the constructors of our classes at runtime.
我们已经解决了依赖性问题:我们在运行时把依赖性注入到类的构造器之中。
We have resolved our dependency issue: we are going to inject our dependencies into the constructors of our classes at runtime.
应用推荐