I have setup an spring scheduler service which is running on local server as expected. But when I deployed it to heroku server the scheduler service is not running.
The below is the main service:
@Configuration
@SpringBootApplication(scanBasePackages = {"com.spring.test"})
@EnableScheduling
public class SpringTest{
public static void main(String[] args) {
SpringApplication.run(SpringTest.class, args);
}
}
And scheduler method is as mentioned below:
@Service
@Component
public class ScheduledTasks {
@Scheduled(fixedRate = 900000)
public void reminderScheduler() {
//some tasks will execute here...
}
}
Your configuration seems good, you need more logging in the class ScheduledTasks
, just to be sure that what exception is coming (if any). Spring scheduler should work in this case.