spring task scheduling

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xmlns:task="http://www.springframework.org/schema/task"

xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd

        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd

       http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd">

 

<context:component-scan base-package="com.sf.Annual.task" />

<!-- register bean -->

<bean id = "annualTask"  class="com.sf.Annual.task.AnnualTask" />

<!-- Open task scheduling -->

<task:scheduled-tasks>

<task:scheduled ref="annualTask" method="shakeRedPacket" cron="*/1 * * * * ?"/>

</task:scheduled-tasks>

 

<task:scheduled-tasks>

<task:scheduled ref="annualTask" method="pushBarrage" cron="*/1 * * * * ?"/>

</task:scheduled-tasks>

   

  <task:scheduled-tasks>

<task:scheduled ref="annualTask" method="annuaMeetingStart" cron="*/1 * * * * ?"/>

</task:scheduled-tasks>

 <!-- ref is the job class

method is the method to be executed in the work class

initial-delay is the delay before the task is called for the first time, in milliseconds

fixed-delay is the delay to call again after the previous call is complete

fixed-rate is the delay to call again after the previous call starts (without waiting for the previous call to complete)

cron is an expression that indicates when to schedule tasks.

  -->

</beans>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326334577&siteId=291194637