摘要: 依赖注入的作用 DI 有什么作用?DI 本身并不是目的,而是达到目的的一种手段。它的作用是帮助我们尽可能的编写可维护的代码,以便能实现高效地交付可运行的软件。 使代码具有可维护性的方法之一就是松散耦合。 也就是在《设计模式》第二版中提到过的:Program to an interface, not 阅读全文
posted @ 2025-05-19 14:58 zhaotianff 阅读(314) 评论(0) 推荐(0)