Skip to content

Commit

Permalink
feat: 메일 전송 cron 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ay-eonii committed Aug 19, 2023
1 parent 645e925 commit 4fd3325
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/land/leets/LeetsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableJpaAuditing
@EnableScheduling
public class LeetsApplication {

public static void main(String[] args) {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/land/leets/global/cron/SendMailCron.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package land.leets.global.cron;

import land.leets.domain.mail.usercase.SendMail;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@RequiredArgsConstructor
@Component
public class SendMailCron {
private final SendMail sendMail;

// @Scheduled(cron = "0 0 10 4 9 ?")
@Scheduled(cron = "10 35 23 19 8 ?")
public void sendPaperMail() {
sendMail.execute("paper");

log.info("Send paper result mail successfully.");
}

@Scheduled(cron = "0 0 18 11 9 ?")
public void sendFinalMail() {
sendMail.execute("final");

log.info("Send final result mail successfully.");
}
}

0 comments on commit 4fd3325

Please sign in to comment.