阅读背景:

当方法需要创建新对象时,有关依赖注入的新手问题

来源:互联网 

I've been reading about dependency injection and have a simple question. I can understand how via constructor or setter injection required dependencies are autowired by the DI framework. What happens when an object decides it needs to create a new object due to some business process? Do I need to always create a Factory in these situations? To make it a less abstract question, here is an example.I've been reading about dependency injection an




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: