NutzCN Logo
问答 怎么在Ioc中定义一个泛类型类,现在的写法,只能定义一个普通类
发布于 2877天前 作者 汉歌 1946 次浏览 复制 上一个帖子 下一个帖子
标签:

var ioc = { gatheConf : { type : "xxx.xxx.classA<xxx.xxx.classB>", } }
5 回复

工厂方法

var ioc = {
	gatheConf : {
		type : "xxx.xxx.classA",
		factory : "xxx.yyy.zzz.AFactory",
		args : ["xxx.yyy.zzz.B"]
	}
}

写错了. 应该是带create方法的

var ioc = {
	gatheConf : {
		type : "xxx.xxx.classA",
		factory : "xxx.yyy.zzz.AFactory#create",
		args : ["xxx.yyy.zzz.B"]
	}
}

另外, 用工厂方法的时候, type不需要写也行

添加回复
请先登陆
回到顶部