我的beans配置在spring scheduler中。xml
<?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:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.2.xsd">
<task:executor id="executor" pool-size="5"/>
<task:scheduler id="scheduler" pool-size="10"/>
<bean id="UpdateScheduler" class="org.ws.scheduled.UpdateScheduler" />
<bean id="PatchData" class="org.ws.scheduled.PatchData" />
<task:scheduled-tasks>
<task:scheduled ref="UpdateScheduler" method="start" fixed-delay="1000" />
<task:scheduled ref="PatchData" method="start" fixed-delay="5000" />
</task:scheduled-tasks>
<task:annotation-driven scheduler="scheduler" executor="executor" />
</beans>