Skip to content

Commit

Permalink
[#94] feat: AsyncConfig 파일을 만들어서 @EnableAsync 어노테이션 Config 파일로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonJuuuun committed Dec 29, 2024
1 parent 1804b52 commit d0685dc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/itcast/async/AsyncConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@EnableAsync
public class AsyncConfig {

@Bean
@Bean(name = "taskExecutor")
public Executor mailTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
Expand Down
1 change: 0 additions & 1 deletion schedule/src/main/java/itcast/ScheduleApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@SpringBootApplication
@EnableScheduling
@EnableAsync
public class ScheduleApplication {
public static void main(String[] args) {
SpringApplication.run(ScheduleApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ public class MailService {
private final AmazonSimpleEmailService amazonSimpleEmailService;
private final EmailSender emailSender;

@Async
@Async("taskExecutor")
public void send(final SendMailRequest sendMailRequest) {
log.info("MailService.send() 실행 스레드: {}", Thread.currentThread().getName());
try {
final SendEmailRequest emailRequest = emailSender.from(sendMailRequest);
amazonSimpleEmailService.sendEmail(emailRequest);
Expand Down

0 comments on commit d0685dc

Please sign in to comment.