Understanding the need for a DI framework

前端 未结 12 1806
长情又很酷
长情又很酷 2020-12-07 12:39

This might be a naive question. I\'m currently learning the Spring framework and dependency injection. While the basic principle of DI is rather easy to grasp, it\'s

12条回答
  •  清歌不尽
    2020-12-07 13:21

    Spring helps you understand and even encourages DI models. However, I don't believe you have to have Spring.

    You can have configuration files in Java which you can debug, refactor and perform code analysis on.

    I suggest you put these java configuration files in another package, but they are otherwise equivalent to XML configuration files. You can even load these file dynamically if that's important.

提交回复
热议问题