springboot中的一些好用注解
一、sprinboot配置文件bean @ConfigurationProperties
https://www.jianshu.com/p/7f75936b573b
二、线程池配置bean @EnableAsync、@Async
@Configuration @EnableAsync public class ThreadPoolConfig { private static final Logger logger = LoggerFactory.getLogger(ThreadPoolConfig.class); @Bean public Executor asyncServiceExecutor(){ logger.info("start asyncServiceExecutor"); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(6); executor.setMaxPoolSize(12); executor.setQueueCapacity(50); executor.setKeepAliveSeconds(3); executor.setThreadNamePrefix("AsyncService-"); executor.initialize(); return executor; } }
@Async("asyncServiceExecutor") pulic void xxx(){ //todo }
不积跬步无以至千里