A Java application — a loose term that runs the gamut from constrained, embedded applications to n-tier, server-side enterprise applications — typically consists of objects that collaborate to form the application proper. Thus the objects in an application have dependencies on each other.
Java应用程序 - 一个宽松的术语,其运行范围从受限的嵌入式应用程序到n层,服务器端企业应用程序 - 通常由协作形成应用程序的对象组成。 因此,在一个应用程序中的对象具有关于彼此的依赖性。
Although the Java platform provides a wealth of application development functionality, it lacks the means to organize the basic building blocks into a coherent whole, leaving that task to architects and developers. Although you can use design patterns such as Factory, Abstract Factory, Builder, Decorator, and Service Locator to compose the various classes and object instances that make up an application, these patterns are simply that: best practices given a name, with a description of what the pattern does, where to apply it, the problems it addresses, and so forth. Patterns are formalized best practices that you must implement yourself in your application.
尽管Java
平台提供了丰富的应用程序开发功能,但它缺乏将基本构建块组织成一个整体的手段,将该任务留给架构师和开发人员。虽然可以使用设计模式,例如工厂,抽象工厂,建筑模式,装饰器和服务定位器等设计模式来组成构成应用程序的各种类和对象实例,这些模式是:最佳实践给出一个名字,有什么模式的描述,如何应用它,它解决的问题,等等。 模式是形式化的最佳实践,你必须在应用程序中实现自己。
The Spring Framework Inversion of Control (IoC) component addresses this concern by providing a formalized means of composing disparate components into a fully working application ready for use. The Spring Framework codifies formalized design patterns as first-class objects that you can integrate into your own application(s). Numerous organizations and institutions use the Spring Framework in this manner to engineer robust, maintainable applications.
Spring框架控制反转(IoC)组件通过提供一种形式化的手段将不同的组件组成一个完全可用的应用程序来解决这个问题。 Spring框架将形式化的设计模式编译为可以集成到自己的应用程序中的第一类对象。 许多组织和机构以这种方式使用Spring框架来设计强大的,可维护的应用程序。(就是将各种设计模式融合到框架中,而开发人员只需要关注自己的逻辑,在不知不觉中就已经用到了最佳的设计模式,自己的代码也得以健壮)
背景
"The question is, what aspect of control are [they] inverting?" Martin Fowler posed this question about Inversion of Control (IoC) on his site in 2004. Fowler suggested renaming the principle to make it more self-explanatory and came up with Dependency Injection.
“现在的问题是,什么方面的控制是(他们)反转?” Martin Fowler在2004年在他的网站上提出了关于反转控制(IoC)的问题.Fowler建议重命名这个原则,使其更一目了然,并提出依赖注入。