inversify学习
June 01, 2019
container
scope
这个 scope 的wiki没有太讲清楚, request_scope.test 这个单测基本说的就很明白了
TransientScope 所有的都是新的,这个很好理解
SingletonScope 顾名思义单例模式,所有通过容器获取到的实例都是同一个
RequestScope 同一个对象里面的是同一个(除非用tag或者targetName限制住)
targetName 和 tagged
targetName不能传参,tagged注解的时候可以加参数
阅读量
Written by xi ming You should follow him on Github