<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd " default-lazy-init ="true"> <task:annotation-driven /> <!-- 定时器开关--> <bean id="PGTask" class="com.casic.PgInterface.overtimeInPG.task.SyncPGtask"></bean> <task:scheduled-tasks> <task:scheduled ref="PGTask" method="overtimeInPG" cron="0 0/20 * * * ?" /> <task:scheduled ref="PGTask" method="getAllMac" cron="0 0 0 0 1/1 ? "/> </task:scheduled-tasks> <context:component-scan base-package="com.casic.PgInterface.overtimeInPG.task" /> </beans>