I am trying to write one cron expression to run it in everyday in midnight (12:00 AM).
@Scheduled(cron = "0 0 0 * * ?")
@Component
@RequiredArgsConstructor
public class TestScheduler {
private final UserService userService;
private final TestService testService;
@Scheduled(cron = "0 0 0 * * ?")
public void anonymizedApplicant() {
testService.getUsers().forEach(user -> {
userService.remove(user.getId());
});
}
}
is it correct expression if not, could someone help me to write this.