package com.hbbh.adapter.schedule;
|
|
import com.hbbh.adapter.manager.DataSource;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import java.time.LocalDateTime;
|
|
@Configuration
|
@EnableScheduling
|
public class Task {
|
|
@Autowired
|
DataSource dataSource;
|
|
/**
|
* 间隔5秒 执行一次
|
*/
|
//@Scheduled(cron = "0/5 * * * * ?")
|
@Scheduled(fixedRate=10000)
|
private void task01() throws Exception {
|
dataSource.execute();
|
}
|
}
|