package com.glxp.api.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; // 1. 创建配置类(建议放在config包下) @ConfigurationProperties(prefix = "thread.pool") @Data public class ThreadPoolConfigProperties { /** * 核心线程数(默认CPU核心数) */ private Integer corePoolSize; /** * 最大线程数(默认CPU核心数*2) */ private Integer maxPoolSize; /** * 队列容量(默认200) */ private int queueCapacity = 200; /** * 线程空闲时间(秒,默认60) */ private int keepAliveSeconds = 60; /** * 线程名前缀(默认"custom_executor_") */ private String threadNamePrefix = "custom_executor_"; }