1 Star 0 Fork 0

stone264/java-design-patterns

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
layouttitlefolderpermalinkcategoriestags
patternDependency Injectiondependency-injection/patterns/dependency-injection/Behavioral
JavaDifficulty-Beginner

Intent

Dependency Injection is a software design pattern in which one or more dependencies (or services) are injected, or passed by reference, into a dependent object (or client) and are made part of the client's state. The pattern separates the creation of a client's dependencies from its own behavior, which allows program designs to be loosely coupled and to follow the inversion of control and single responsibility principles.

alt text

Applicability

Use the Dependency Injection pattern when

  • when you need to remove knowledge of concrete implementation from object
  • to enable unit testing of classes in isolation using mock objects or stubs
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuqr32/java-design-patterns.git
git@gitee.com:wuqr32/java-design-patterns.git
wuqr32
java-design-patterns
java-design-patterns
master

搜索帮助