首页新闻找找看学习计划

使用定时器报错,是因为service注入失败吗

0
[待解决问题]

<bean id="sendIns" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="cbrcCustomerInformationService"></property>
<property name="targetMethod" value="sendInstitutionalInformation"></property>
<property name="concurrent" value="false"></property>
</bean>
<!-- Trigger -->
<bean id="sendIn" class="org.springframework.scheduling.quartz.CronTriggerBean">
<!-- 定时器定时0点钟开始调用plBidCompensatoryService.calculateOverDueDays方法-->
<property name="cronExpression">
<value>0 * 9 * * ?</value>
</property>
<property name="jobDetail" ref="sendIns"/>
</bean>

<bean id="cbrcCustomerInformationService" class="com.zhiwei.credit.service.cbrc.impl.CbrcCustomerInformationServiceImpl">
<constructor-arg index="0" ref="cbrcCustomerInformationDao"/>
</bean>

Exception in thread "Timer-0" java.lang.NullPointerException
at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.isLoggable(Log4jMLog.java:257)
at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:1934)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

我是司的主页 我是司 | 菜鸟二级 | 园豆:204
提问于:2018-10-20 09:16
< >
分享
所有回答(1)
0

在xml里写实在是 太冗长了,在方法上用@scheduled注解吧,然后为包含@Scheduled注解的类注册一个bean或者配置自动扫描

o魅影0 | 园豆:160 (初学一级) | 2018-10-22 10:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册