Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
495 B
5
Indexable
Never

@AllArgsConstructor
@Component
@EnableScheduling
public class ScheduleStarter {
    @EventListener(ApplicationReadyEvent.class) {
        public void startCron() {
            scheduleService.start();
        }
    }
}



@Service
@RequiredArgsConstructor
public class ScheduleService {
    public void start() {
        getLockableTaskScheduler().schedule(() -> {
            LockAssert.assertLocked();
            pushForecast();
        
        }, new CronTrigger("* */1 * * * *"));
    }
}