NutzCN Logo
问答 获取Ioc容器对象问题
发布于 2321天前 作者 bb3239 2238 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

private static Class<?> getObjFromIoc(Class<?> type){
return Mvcs.getIoc().get(type.getClass());
}

想写一个静态函数,获取Ioc对象,执行getObjFromIoc(A.class)后报错(A是@IocBean),水平有限,望指导

3 回复
private static T getObjFromIoc(Class<T> type){
    return Mvcs.getIoc().get(type);
}

get(java.lang.Class<T>)in Ioc cannot be applied to(java.lang.Class<T>)
 
 reason: no instance(s) of type variable(s) exist so that T conforms to Object inference variable T has incompatible bounds: equality constraints: T upper bounds: Object
添加回复
请先登陆
回到顶部