控制反转与控制之间的区别依赖注入 [英] Difference between Inversion of Control & Dependency Injection

查看:130
本文介绍了控制反转与控制之间的区别依赖注入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IoC和DI概念对我来说非常混乱,所以我阅读了很多观点和不同人的帖子,最后得出结论。因此我理解这些主题是...

IoC and DI concept were very much confusing for me so I read lots of views and post of different people and finally reach to the conclusion. So as I understand these topics are...

控制反转是java中用于制作松散耦合和更易于维护的应用程序的技术,并且依赖注入是一种实现这个概念(技术)的方法。

Inversion of control is a technique in java for making loosely coupled and more easily maintainable applications, and dependency injection is a one of the way to achieve this concept(technique).

控制容器的反转在运行时从java类注入依赖关系,以生成松散耦合的应用程序。

Inversion of control container inject dependency at run time from java classes to make loosely coupled application.

这是真的吗?如果我错了,请纠正我...

Is this true ? correct me if I am wrong...

推荐答案

IoC是一个通用术语,而不是让应用程序调用方法框架,框架调用应用程序提供的实现。

IoC is a generic term meaning rather than having the application call the methods in a framework, the framework calls implementations provided by the application.

DI是IoC的一种形式,其中实现通过构造函数/ setter / service查找传递到对象,该对象将依赖以便正确行事。

DI is a form of IoC, where implementations are passed into an object through constructors/setters/service look-ups, which the object will 'depend' on in order to behave correctly.

参考:控制反转与依赖注入

这篇关于控制反转与控制之间的区别依赖注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆