一个spring定时钟的例子 (月涯网络)

下面是配置的spring文件/applicationContext.xml配置 ,完整的在


http://techlife21.cn/read.php?tid=131&keyword=spring

复制代码
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  5.       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd  
  6.            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd  
  7.            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd"
  8.  default-autowire="byName">
  9. <bean id="userDaoImpl" class="yongkang.qiyk.mylove.app.bo.impl.UserDaoImpl">
  10.  <property name="hello" value="hello world"></property>
  11. </bean>
  12. <!-- 普通的bean -->
  13. <bean id="myjob" class="yongkang.qiyk.mylove.app.task.MyJobScheduler"/>
  14. <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  15.  <property name="triggers">
  16.   <list>
  17.    <ref bean="myjobTrigger"/>
  18.   </list>
  19.  </property>
  20.   <property name="autoStartup" value="true" />  
  21. </bean>
  22. <bean id="myjobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
  23.  <property name="jobDetail" ref="myjobDetail"/>
  24.  <!-- 每隔1秒钟触发一次 -->  
  25.     <property name="cronExpression" value="*/5 * * * * ?" />
  26. </bean>
  27.  <!-- 计划 -->  
  28. <bean id="myjobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  29.  <property name="targetObject" ref="myjob"/>
  30.  <property name="targetMethod" value="execute"/>
  31.  <!-- 是否允许任务并发执行。当值为false时,表示必须等到前一个线程处理完毕后才再启一个新的线程 -->  
  32.     <property name="concurrent" value="false" />
  33. </bean>
  34. </beans>

 

你可能感兴趣的:(spring,AOP,PHP,bean,quartz)