Skip to content

Instantly share code, notes, and snippets.

@sheelprabhakar
Last active March 6, 2021 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheelprabhakar/84fb373fb6aa3187985218ab22087362 to your computer and use it in GitHub Desktop.
Save sheelprabhakar/84fb373fb6aa3187985218ab22087362 to your computer and use it in GitHub Desktop.
Spring boot application to execute a task every hour
@SpringBootApplication
@EnableScheduling
public class Application {
@Autowired
private WeatherAgentService weatherAgentService;
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
//600000
@Scheduled(fixedRate = 600000)
public void postWeather() {
this.weatherAgentService.update();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment