Inversion of Control Containers and the Dependency Injection pattern | Инверсия управления и шаблон внедрение зависимости History of edits
(Latest: Bishop 1 year ago)
§ | |
In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use. | | |
Last significant update: 23 Jan 04 | Последнее значительное обновление: 23 января 2004 History of edits
(Latest: Bishop 1 year ago)
§ | |
| | |
| | |
| | |
| | |
Forms of Dependency Injection | | |
Constructor Injection with PicoContainer | | |
Setter Injection with Spring | | |
Using a Segregated Interface for the Locator | | |
A Dynamic Service Locator | | |
Using both a locator and injection with Avalon | | |
Deciding which option to use | | |
Service Locator vs Dependency Injection | | |
Constructor versus Setter Injection | | |
Code or configuration files | | |
Separating Configuration from Use | Отделение конфигурации от использования History of edits
(Latest: Bishop 1 year ago)
§ | |
| | |
One of the entertaining things about the enterprise Java world is the huge amount of activity in building alternatives to the mainstream J2EE technologies, much of it happening in open source. A lot of this is a reaction to the heavyweight complexity in the mainstream J2EE world, but much of it is also exploring alternatives and coming up with creative ideas. A common issue to deal with is how to wire together different elements: how do you fit together this web controller architecture with that database interface backing when they were built by different teams with little knowledge of each other.A number of frameworks have taken a stab at this problem, and several are branching out to provide a general capability to assemble components from different layers. These are often referred to as lightweight containers, examples include PicoContainer, and Spring. | | |