Timer是个新线程,与连接数据库的线程不是同一个,我要在Timer中对数据操作还要重新连接一次数据库? 如果需要,怎么连接??
现在一直报Exception in thread "Timer-0" java.lang.NullPointerException 这个错误!
收起
你是想完成定时任务之类的?还是异步之类的? 考虑Spring Schedule,或者Spring async,Timer基本没见使用过
报告相同问题?