1 <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> 2 <property name="triggers"> 3 <list> 4 <ref bean="doTime30" /> 5 </list> 6 </bean> 7 <bean id="doTime30" class="org.springframework.scheduling.quartz.CronTriggerBean"> 8 <property name="jobDetail"> 9 <ref bean="jobtask30"/> 10 </property> 11 <property name="cronExpression"> 12 <!-- 每小时执行一次 --> 13 <value>0 0 * * * ?</value> 14 </property> 15 </bean> 16 <bean id="jobtask30" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> 17 <!-- 调用的类 --> 18 <property name="targetObject"> 19 <ref bean="onsManager"/> 20 </property> 21 <!-- 调用类中的方法 --> 22 <property name="targetMethod"> 23 <value>insertSynchronizedTopic</value> 24 </property> 25 </bean>
onsManeger配置
1 <bean id="onsManager" parent="baseTransactionProxy"> 2 <property name="target"> 3 <bean class="com.aliyun.pcitcAliyun.ons.manager.imp.OnsManagerImp"> 4 <property name="onsDao" ref="onsDao" /> 5 <property name="akDao" ref="akDao" /> 6 </bean> 7 </property> 8 </bean>
onsManager和OnsManagerImpl中都加入insertSynchronizedTopic方法,否则启动报错NoSuchMethodException