midwayjs / injection

Injection is a powerful inversion of control container that is widely used in the midway framework and brings good user experience.
MIT License
160 stars 20 forks source link

您好,请问如何使用autowire实例化有参构造函数的对象 #47

Closed feiyueXH closed 4 years ago

kurten commented 4 years ago

可以使用构造器注入的方式,midway 支持 config、logger、class 这样的实例注入 https://midwayjs.org/midway/ioc.html#%E6%9E%84%E9%80%A0%E5%99%A8%E6%B3%A8%E5%85%A5

lubezhang commented 4 years ago

如果不使用注入的方式,只用容器的api,如何做?

是在bind阶段做? 还是在get阶段做?

czy88840616 commented 4 years ago

container.get() or container.getAsync()