handle类(单例):
public class OfferingOrderHandler {
private static OfferingOrderHandler offeringOrderHandler = null;
public static OfferingOrderHandler getInstance() {
if (offeringOrderHandler == null) {
offeringOrderHandler = new OfferingOrderHandler();
}
return offeringOrderHandler;
}
OfferingDAO offeringDao = new OfferingDAO();
ProductDAO productDAO = new ProductDAO();
}
红色部分为debug时后面添加的,由于代码一直是 OfferingOrderHandler.getInstance()来取得handle类的,因此该对象一直在内存中获取,但ProductDAO是 后来添加的,因此获取的handle类一直不带ProductDAO对象,
其实,这问题本身很简单,毕竟控制台会报错,空指针,,但项目原因,错误没报出来,后来重启服务器才焕然大悟。