简体   繁体   中英

Spring boot embedded tomcat threadpool configuration

Application is built using spring boot.My application uses application.yaml for external config.But when i am trying to add below config in application.yaml, application fails to start with error as tomcat is not valid.However similar equivalent config I have tried in another application with application.propeties it works there.

server:
    port:8080
    tomcat:
      max-threads:500
      accept-count:500
      max-connections:10000
      min-spare-threads:500

What is the springBoot version being used in the other application?

FYI server.tomcat.max-threads is deprecated since Springboot 2.3, now use server.tomcat.threads.max in your Spring application.properties. https://docs.spring.io/spring-boot/docs/2.4.0/reference/html/appendix-application-properties.html#common-application-properties

For me this seems to work in application.yaml

server:
    port: 8080
    tomcat: 
        max-threads: 500
        accept-count: 500
        max-connections: 10000
        min-spare-threads: 500

or this in application.properties

server.port = 8080
server.tomcat.max-threads = 500
server.tomcat.accept-count = 500
server.tomcat.max-connections = 10000
server.tomcat.min-spare-threads = 500

If it doesn't work, maybe there is an error in your dependencies?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM