Skip to content

Commit

Permalink
[#94] feat: AsyncConfig 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonJuuuun committed Dec 29, 2024
1 parent 607cba3 commit 1804b52
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions common/src/main/java/itcast/async/AsyncConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package itcast.async;

import java.util.concurrent.Executor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
@EnableAsync
public class AsyncConfig {

@Bean
public Executor mailTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(3);
executor.setQueueCapacity(50);
executor.setThreadNamePrefix("MailTaskExecutor-");
executor.initialize();
return executor;
}
}

0 comments on commit 1804b52

Please sign in to comment.