Spring Dependency Injection 简明教程
Spring DI Tutorial
Spring 最常与其相关联的技术是反转控制的依赖项注入 (DI) 风格。反转控制 (IoC) 是一个通用概念,并且可以用许多不同的方式来表达。依赖项注入仅仅是反转控制的一个具体示例。
The technology that Spring is most identified with is the Dependency Injection (DI) flavor of Inversion of Control. The Inversion of Control (IoC) is a general concept, and it can be expressed in many different ways. Dependency Injection is merely one concrete example of Inversion of Control.
在编写复杂的 Java 应用程序时,应用程序类与其它的 Java 类应该尽可能独立,以提高在单元测试时独立于其他类来重复利用和测试这些类的可能性。依赖关系注入有助于将这些类粘合在一起,并同时保持它们的独立性。
When writing a complex Java application, application classes should be as independent as possible of other Java classes to increase the possibility to reuse these classes and to test them independently of other classes while unit testing. Dependency Injection helps in gluing these classes together and at the same time keeping them independent.
在本教程中,我们将介绍 Spring 框架中所有类型的依赖注入,它们有助于解决基于 Spring 框架的应用程序中开发人员/用户面临的常见问题。
In this tutorial, we’ll cover all the ways of Dependency Injection in Spring framework which helps in solving the common problems developers/users face in spring framework based applications.
Audience
本教程专为 Java 程序员设计,他们需要详细了解 Spring 框架及其架构和实际用法。本教程将带你达到中级专业水平,从此你可以向更高的专业水平迈进。
This tutorial is designed for Java programmers with a need to understand the Spring framework in detail along with its architecture and actual usage. This tutorial will bring you at an intermediate level of expertise, from where you can take yourself to higher levels of expertise.