Home > Back-end >  deprecated property: connection-timeout: 12000
deprecated property: connection-timeout: 12000

Time:06-21

I have this property into Spring Boot application:

server:
  connection-timeout: 12000

I get warning:

Deprecated Each server behaves differently. Use server specific properties instead. 
  Gradle: org.springframework.boot:spring-boot-autoconfigure:2.6.8 (spring-boot-autoconfigure-2.6.8.jar)

is there some better configuration property that I can use?

CodePudding user response:

I don't even know why you receive a deprecated warning.

According to the documentation from Spring Boot version 2.3 and onwards this property is removed not deprecated any more.

As you can read here, there are some other properties which you can use instead depending on the server that runs your spring boot application.

server.tomcat.connection-timeout should be used if you have tomcat as running server.

server.netty.connection-timeout should be used if netty is used.

server.jetty.connection-idle-timeout should be used if jetty is used

Basically each server has it's own implementation, so you must read your server's documentation to see what it allows and how this behaves. There might be slight differences from how one server behaves and how it interprets connection-timeout and how another server behave and interprets a similar configuration.

This is I think the reason that Spring decides to move to server specific configuration on property connection-timeout instead of a general property and also a very important reason was that some servers may not even have this configuration available to them. So then you have a general property configured in your spring boot application which the server that runs the application can't even respect.

Therefore you now have specific properties for specific servers and now you can be sure upfront whether this configuration is available in your server and you can also read the server documentation to understand exactly what the behavior will be.

  • Related