簡體   English   中英

Spring 啟動嵌入式 tomcat 線程池配置

[英]Spring boot embedded tomcat threadpool configuration

應用程序是使用 spring 啟動構建的。我的應用程序使用 application.yaml 進行外部配置。但是當我嘗試在 application.yaml 中添加以下配置時,應用程序無法啟動並出現錯誤,因為 tomcat 無效。但是我嘗試過類似的等效配置在另一個帶有 application.propeties 的應用程序中,它在那里工作。

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

其他應用程序中使用的 springBoot 版本是什么?

僅供參考server.tomcat.max-threadsSpringboot 2.3 以來已棄用,現在在您的 Spring application.properties 中使用server.tomcat.threads.max https://docs.spring.io/spring-boot/docs/2.4.0/reference/html/appendix-application-properties.html#common-application-properties

對我來說,這似乎適用於application.yaml

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

或者這個在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

如果它不起作用,也許您的依賴項中有錯誤?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM