Skip to content

Commit

Permalink
chore : 스케줄러 test 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
LHS-11 committed Feb 13, 2024
1 parent ddd11c5 commit a1f9183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import org.springframework.scheduling.annotation.EnableScheduling;

@Configuration
//@EnableScheduling
@EnableScheduling
public class SchedulerConfig {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
import com.cmc.zenefitserver.global.infra.notification.domain.Notification;
import com.cmc.zenefitserver.global.infra.notification.domain.NotificationType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.net.URL;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@RequiredArgsConstructor
@Service
@Slf4j
public class NotificationScheduler {

private final PolicyRepository policyRepository;
Expand All @@ -32,8 +32,10 @@ public class NotificationScheduler {
private final NotificationRepository notificationRepository;


@Scheduled(cron = "0 0 0 * * *") // 매일 오전 12시에 실행
// @Scheduled(cron = "0 0 0 * * *") // 매일 오전 12시에 실행
@Scheduled(cron = "0 0/3 * 1/1 * ? *") // 매일 오전 12시에 실행
public void notifyUser() {
System.out.println("LocalDate.now() = " + LocalDate.now());
notifyUserBySttDate(LocalDate.now()); // 신청 시작일 기준
notifyUserByEndDate(LocalDate.now()); // 신청 종료일 기준
// notifyUserByApplyDate(LocalDate.now()); 신청일 기준
Expand Down

0 comments on commit a1f9183

Please sign in to comment.