Spring 调度程序在服务器上不工作
Spring scheduler not working at server
我已经按照预期在本地服务器上设置了 spring 调度程序服务 运行。但是当我将它部署到 heroku 服务器时,调度程序服务不是 运行.
以下是主要服务:
@Configuration
@SpringBootApplication(scanBasePackages = {"com.spring.test"})
@EnableScheduling
public class SpringTest{
public static void main(String[] args) {
SpringApplication.run(SpringTest.class, args);
}
}
调度器方法如下:
@Service
@Component
public class ScheduledTasks {
@Scheduled(fixedRate = 900000)
public void reminderScheduler() {
//some tasks will execute here...
}
}
您的配置似乎不错,您需要在 class ScheduledTasks
中进行更多登录,以确保出现什么异常(如果有)。 Spring 调度程序应该在这种情况下工作。
我已经按照预期在本地服务器上设置了 spring 调度程序服务 运行。但是当我将它部署到 heroku 服务器时,调度程序服务不是 运行.
以下是主要服务:
@Configuration
@SpringBootApplication(scanBasePackages = {"com.spring.test"})
@EnableScheduling
public class SpringTest{
public static void main(String[] args) {
SpringApplication.run(SpringTest.class, args);
}
}
调度器方法如下:
@Service
@Component
public class ScheduledTasks {
@Scheduled(fixedRate = 900000)
public void reminderScheduler() {
//some tasks will execute here...
}
}
您的配置似乎不错,您需要在 class ScheduledTasks
中进行更多登录,以确保出现什么异常(如果有)。 Spring 调度程序应该在这种情况下工作。