<bean name="updateMarket" class="cn.market.quartz.IntegralUpdate"
singleton="false">
<property name="mgr1">
<ref bean="userManager" />
</property>
</bean>
<bean id="jobDetaill"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="updateMarket" />
<property name="targetMethod" value="marketIntegral" />
<property name="concurrent" value="false" />
</bean>
<bean id="cronTriggers"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobDetaill" />
<property name="cronExpression" value="0 20 00 * * ? *"/>
</bean>
以下是配置userManager;
<bean id="userManager" parent="baseTxProxy">
<property name="target">
<bean
class="cn.market.service.impl.MarketUserManagerImpl">
<property name="userDaoHibernate" ref="userDao" />
<property name="userLogDaoHibernate" ref="loginLogDao" />
</bean>
</property>
</bean>
其中mgr1为实现接口的一个成员,userManager为操作userManager的ID.,marketIntegral代表要执行的方法,"0 20 00 * * ? *"/表示每天晚上自动运行
附代码:
public class IntegralUpdate {
private IMarketUserManager mgr1;
public void marketIntegral(){
mgr1.updateMarketUserSql("update Marketuser set Integral=Integral+30 where marketid='4028809911c5847b0111c58c3a9e0002'");
}
public void setMgr1(IMarketUserManager mgr1) {
this.mgr1 = mgr1;
}
}
posted on 2008-01-09 09:09
方涛升 阅读(265)
评论(0) 编辑 收藏 所属分类:
spring