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

What is default response timeout for spring-boot-starter-jetty

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

您可以在 ServerProperties class:

上找到默认值

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

看看这个class我们可以检查没有默认值:

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