0

I have created client using below site. We are not allowed to use embedded tomcat, so war was deployed in tcServer. The methods in the client needs to be scheduled. All the methods are in SpringBootApp. How to schedule to run the client every 15 minutes.

Can someone guide me on how to do this?

RestClient Code

1 Answers1

0

Scheduling is pretty easy. It doesn't matter if you are using embedded tomcat or not. You have SpringBoot and that's enough. Steps to configure schedule method:

  1. Add @EnableScheduling annotation on your config class or even next to @SpringBootApplication.
  2. Create Scheduler class, that will fire methods in time intervals like this:

    @Service public class MyScheduler { @Scheduled(cron = "* */15 * * * *") void someMethod() { // do stuff here } }

Cron expressions are explained here: https://stackoverflow.com/a/26147143/7866105

tutorial:
https://spring.io/guides/gs/scheduling-tasks/ and http://www.baeldung.com/spring-scheduled-tasks

wkubasik
  • 786
  • 6
  • 8