spring quartz 定时任务,访问bean空指针异常

cuihao cuihao 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

做了一个定时任务,但是在运行的时候总是报错:XmlToTableTask 中的IHrmisBiz_为空

public class XmlToTableTask {

private IHrmisBiz IHrmisBiz_;

private static boolean isRunning = false;

public void run() {

if (!isRunning) {
isRunning = true;
try {
List list = this.IHrmisBiz_.parseXml();---空指针异常
this.IHrmisBiz_.wirteDB(list);
} catch (Exception e) {
}

isRunning = false;
} else {
Log.debug("上一次任务执行还未结束..."); // 上一次任务执行还未结束
}
}

/**
* @return the iHrmisBiz_
*/
public IHrmisBiz getIHrmisBiz_() {
return IHrmisBiz_;
}

/**
* @param hrmisBiz_
* the iHrmisBiz_ to set
*/
public void setIHrmisBiz_(IHrmisBiz hrmisBiz_) {
IHrmisBiz_ = hrmisBiz_;
}
}


<bean name="XmlToTableTask"
class="cmcc.interfaces.hrmis.task.XmlToTableTask">
<property name="IHrmisBiz_">
<ref bean="HrmisBiz" />
</property>
</bean>

<bean name="HrmisBiz" class="cmcc.interfaces.hrmis.biz.HrmisBiz">
<property name="IHrmisDao_">
<ref bean="HrmisDao" />
</property>
</bean>

<bean name="HrmisDao" class="cmcc.interfaces.hrmis.dao.HrmisDao">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate" />
</property>
</bean>

<bean id="methodInvokingJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="XmlToTableTask" />
</property>
<property name="targetMethod">
<value>run</value>
</property>
</bean>

<bean id="cronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="methodInvokingJobDetail" />
</property>
<property name="cronExpression">
<!-- 每个月25日 23点30分触发
<value>0 30 23 25 * ?</value>-->
<value>1 * * * * ?</value>
</property>
</bean>

<bean
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref local="cronTrigger" />
</list>
</property>
</bean>

是我哪里配置错了,请指教。
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
cuihao
Java EE 67,535 成员 225,843 内容