父类:
@IocBean
public class BaseDao {
@Inject
private NutDao dao;
protected List<JSONObject> getArray(HashMap<String, Object> params) {
String sqlName = Thread.currentThread().getStackTrace()[2].getClassName()+"."+Thread.currentThread().getStackTrace()[2].getMethodName();
Sql sql = dao.sqls().create(sqlName);
for (String name : params.keySet()) {
sql.setParam(name, params.get(name));
}
sql.setEntity(dao.getEntity(JSONObject.class));
sql.setCallback(Sqls.callback.entities());
return dao.execute(sql).getList(JSONObject.class);
}
}
子类:
@IocBean
public class UitilDao extends BaseDao{
public List<JSONObject> getCantons(boolean getParent) {
return getArray(new HashMap<String,Object>(){
private static final long serialVersionUID = 1L;
{put("getParent", getParent);}
});
}
}
错误信息:
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.hetaro.dao.UitilDao'
by args: [@(org.nutz.dao.impl.NutDao@60febfd1)]
because: No suitable Constructor or Factory Method!!
at org.nutz.lang.Mirror.born(Mirror.java:1008)
at org.nutz.castor.castor.Object2Object.cast(Object2Object.java:12)
at org.nutz.castor.Castors.cast(Castors.java:252)
... 55 more