Message-ID: <1648689112.5611.1369516368558.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_5610_27824873.1369516368557" ------=_Part_5610_27824873.1369516368557 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
In recent years different approaches have emerged to deliver an IoC visi= on. Latter types, as part of a 'LightWeight' agenda have concentrated on s= implicity and transparency.
Devised at ThoughtWorks' London offices in December of 2003. Present at = the "Dependency Injection" meeting were Paul Hammant, Aslak Helle= soy, Jon Tirsen, Rod Johnson (Lead Developer of the Spring Framework), Mike= Royle, Stacy Curl, Marcos Tarruela and Martin Fowler (by email).
Inversion of Control
See also Constructor Inj= ection, Setter Injection= , Contextualized Lookup= for more information.
Note Field Injection was provisionally known as 'type 4'. There was real= ly no interest 'type 4' until EJB3.0. Getter Injection flourished for a whi= le, but did not take and was never supported by the PicoContainer team.
This is where a dependency is handed into a component via its constructo= r :=20
This is where dependencies are injected into a component via setters := p>=20
This is where dependencies are looked up from a container that is managi= ng the component :=20
Component is the correct name for things managed in an IoC sense. Howev= er very small ordinary classes are manageable using IoC tricks, though this= is for the very brave or extremists
A component many have dependencies on others. Thus dependency is the te= rm we prefer to describe the needs of a component.
Service as a term is very popular presently. We think 'Service' dictates= marshaling and remoteness. Think of Web Service, Database service, Mail se= rvice. All of these have a concept of adaptation and transport. Typically = a language neutral form for a request is passed over the wire. In the cas= e of the Web Service method requests are marshaled to SOAP XML and forward = to a suitable HTTP server for processing. Most of the time an application = coder is hidden from the client/server and marshaling ugliness by a toolkit= or API.
Types 1, 2 and 3 IoC were unilaterally coined earlier in 2003 by the Pic= oContainer team and published widely.
Type 1 becomes Contextualized Dependency Lookup
Type 2 becomes Setter Dependency Injection
Type 3 becomes Constructor Dependency Injection
Dependency Injection is non-invasive. Typically this means that compone= nts can be used without a container or a framework. If you ignore life cycl= e, there is no import requirements from an applicable framework.
Contextualized Dependency Lookup is invasive. Typically this means comp= onents must be used inside a container or with a framework, and requires th= e component coder to import classes from the applicable framework jar.
Note that Apache's Avalon (and all former type-1 designs) are not Depend= ency Injection at all, they are Contextualized Dependency Lookup.
With plain JNDI, lookup can be done in a classes' static initialiser, in= the constuctor or any method including the finaliser. Thus there is no co= ntrol (refer C of IoC). With JNDI used under EJB control, and concerning on= ly components looked up from that bean's sisters (implicitly under the same= container's control), the specification indicates that the JNDI lookup sho= uld only happen at a certain moment in the startup of an EJB application, a= nd only from a set of beans declared in ejb-jar.xml. Hence, for EJB contai= ners, the control element should be back. Should, of course, means that ma= ny bean containers have no clue as to when lookups are actually being done,= and apps work by accident of deployment. Allowing it for static is truly = evil. It means that a container could merely be looking at classes with ref= lection in some early setup state, and the bean could be going off and avai= ling of remote and local services and components. Thus depending whether J= NDI is being used in an Enterprise Java Bean or in a POJO, it is either an = example of IoC or not.------=_Part_5610_27824873.1369516368557--