Spring @Async limit number of threads

前端 未结 3 794
囚心锁ツ
囚心锁ツ 2020-12-03 13:34

My question is very similar to this one : @Async prevent a thread to continue until other thread have finished

Basically i need run ~ hundreds of computations in mor

3条回答
  •  时光说笑
    2020-12-03 14:01

    Since spring boot 2.1 you can use auto configuration and change the maximum number of threads in the application properties file

    spring.task.execution.pool.max-size=4
    

    See the full documentation:
    https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-task-execution-scheduling

提交回复
热议问题