spring-boot-starter-jetty的默认响应超时是多少

时间:2020-05-21 17:33:44

标签: spring-boot jetty

我能知道'spring-boot-starter-jetty'的默认响应超时和连接超时值是什么,以及如何在Spring rest应用程序中配置它们吗?

1 个答案:

答案 0 :(得分:1)

您可以在 ServerProperties 类上找到默认值:

https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/web/ServerProperties.html

查看此类,我们可以检查是否没有默认值:

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java#L1077

/**
 * Amount of time the connector will wait, after accepting a connection, for the
 * request URI line to be presented.
 */
private Duration connectionTimeout;

在这里您可以找到默认的Spring引导属性值:

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#server-properties

如果要设置超时值,只需将属性添加到application.properties文件中:

例如

server.jetty.connection-idle-timeout=5000