定时任务注入的service是null
之前用过3.6版本的,前几天下了一个最新版3.7版本的,发现定时任务有问题,我用官方自带的定时任务进行测试,发现注入的service是null,package org.jeecgframework.web.system.sms.util.task;
import com.jeecg.p3.demo.service.JeecgP3demoService;
import org.jeecgframework.web.system.sms.service.TSSmsServiceI;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
*
* @ClassName:SmsSendTask 所有信息的发送定时任务类
* @Description: TODO
* @author Comsys-skyCc cmzcheng@gmail.com
* @date 2014-11-13 下午5:06:34
*
*/
@Component("smsSendTask")
public class SmsSendTask implements Job{
@Autowired
private TSSmsServiceI tSSmsService;
@Autowired
private JeecgP3demoService jeecgP3demoService;
/*@Scheduled(cron="0 0/1 * * * ?")*/
public void run() {
long start = System.currentTimeMillis();
org.jeecgframework.core.util.LogUtil.info("===================推送消息定时任务开始===================");
System.out.println("tssmservice=" + tSSmsService);
System.out.println("jeecg="+jeecgP3demoService);
try {
tSSmsService.send();
} catch (Exception e) {
e.printStackTrace();
}
org.jeecgframework.core.util.LogUtil.info("===================推送消息定时任务结束===================");
long end = System.currentTimeMillis();
long times = end - start;
org.jeecgframework.core.util.LogUtil.info("总耗时"+times+"毫秒");
}
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
run();
}
}
运行后的结果是: - ===================推送消息定时任务开始===================java.lang.NullPointerException
tssmservice=null
at org.jeecgframework.web.system.sms.util.task.SmsSendTask.run(SmsSendTask.java:41)
jeecg=null
- ===================推送消息定时任务结束===================
- 总耗时2毫秒
at org.jeecgframework.web.system.sms.util.task.SmsSendTask.execute(SmsSendTask.java:53)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
- ===================推送消息定时任务开始===================
java.lang.NullPointerException
tssmservice=null
at org.jeecgframework.web.system.sms.util.task.SmsSendTask.run(SmsSendTask.java:41)
jeecg=null
at org.jeecgframework.web.system.sms.util.task.SmsSendTask.execute(SmsSendTask.java:53)
-
是我哪儿的配置不对吗?
新版3.7.2版本已经解决这个问题,请等待新版发布
页:
[1]