【发布时间】:2019-02-10 22:39:40
【问题描述】:
帮助使用 inRequestScope inversifyJS 例如:
container.bind<ITransactionManager>(Types.MysqlTransactionManager).to(MysqlTransactionManager).inRequestScope()
...
container.get<ITransactionManager>(Types.MysqlTransactionManager)//call the MysqlTransactionManager constructor and return the instance
container.get<ITransactionManager>(Types.MysqlTransactionManager) //call the constructor one more time and return a new instance
我希望在第二次调用 get 时返回相同的实例,而不是再次实例化它
【问题讨论】:
标签: javascript typescript express inversifyjs