SchedulerTask.java
555 Bytes
package com.viontech.job;
import com.viontech.service.impl.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**
* @author zhaibolin
*/
@Component
public class SchedulerTask {
@Autowired
private WeatherService weatherService;
@Scheduled(cron = "${schedules:0 0 8 * * ?}")
private void process() throws IOException {
weatherService.getWeatherInfo();
}
}