package com.palnet; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; @EnableAsync @EnableScheduling @SpringBootApplication public class SocketApplication { public static void main(String[] args) { SpringApplication.run(SocketApplication.class, args); } @Bean public ObjectMapper objectMapper() { return new ObjectMapper(); } @Bean("asyncExecutor") public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(1); // 기본 스레드 수 executor.setMaxPoolSize(10); // 최대 스레드 수 executor.setQueueCapacity(50); // Max 스레드가 동작하는 경우 대기하는 Queue executor.setThreadNamePrefix("Async-"); executor.initialize(); return executor; } }