Difference between creating new object and dependency injection

后端 未结 6 2265
粉色の甜心
粉色の甜心 2020-12-08 01:24

What is the difference between creating a new object and dependency injection? Please explain in detail.

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 02:02

    Dependency injections adds a layer of configurability into your application. In the sense, when you hard code object construction, you need to re-build and re-deploy your app, but when you use dependency injection, you can re configure the XML and change the behavior without re-building and re-deploying. There are a large variety of use cases where this can save a lot of tie and effort.

提交回复
热议问题