1. 程式人生 > >spring task 定時任務 配置

spring task 定時任務 配置

<task:executor id="executor" pool-size="10"/>
<task:scheduler id="scheduler" pool-size="10"/>
<task:annotation-driven scheduler="scheduler" executor="executor" proxy-target-class="true"/>

// spring task註解方式 @Scheduled(cron = “*/5 * * * * ?”) public void test1() { String time = DateFormat.getDateTimeInstance().format(new Date()); System.out.println(“test1定時器觸發列印” + time); }