Using Spring boot 2.2.6.RELEASE.
Based on https://github.com/spring-projects/spring-boot/blob/2.2.x/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizer.java#L90, I would like to set the server.jetty.thread-idle-timeout
to null to avoid spring boot configuring it.
I've tried null
, ~
and an empty string in my yml to configure it however it never works, the setter is never getting invoked and the default value of ServerProperties
of 60s is always kept. A null
Duration
is properly returned by StringToDurationConverter
but somehow after it doesn't get set.
I've looked at the master branch and it seems like the same problem will be there in the next version.
A clean way to completely backoff thread pool configuration would be nice too, I heavily configure mine and I have to juggle to easily make Spring Boot backoff on this.
Thanks
Comment From: wilkinsona
Spring Boot's 60 second default for the thread idle timeout matches Jetty's default. As a result, if you could make Spring Boot back off you'd be left with the same value. Why not set server.jetty.thread-idle-timeout
to the value that you want?
Comment From: jebeaudet
You're right that it matches Jetty default value, however I think this is risky as Jetty could change the default value (they know better than us I guess) and we would override theirs. Same for the rest of the configuration values I guess. I believe a more sane approach would be to not set anything unless it's overriden and/or required.
I heavily configure my thread pool and I have setters that 1. can set the value dynamically at runtime based on netflix archaius and 2. set the proper value at boot based on what's in archaius.
With this, the only way to get proper result is if my WebServerFactoryCustomizer
runs after the Spring Boot one, properly overriding the default values Spring set. I set the min/max thread count to -1
so Spring backs off but I can't do the same with the thread idle timeout.
Comment From: wilkinsona
We deliberately have default values so that they appear in the metadata that provides auto-completion for the properties in your IDE. We have tests that verify that the server property defaults match the containers' defaults, although on first look I can't find one for the thread-idle-timeout. We can use this issue to add one if it's missing.
With this, the only way to get proper result is if my WebServerFactoryCustomizer runs after the Spring Boot one, properly overriding the default values Spring set.
This is what you should do. JettyWebServerFactoryCustomizer
has an order of 0 so that you can add customiser that run either before or after it.
Comment From: jebeaudet
Good to hear about the tests, didn't know that. Also didn't know that you did this for the auto-completion, I use that almost every day and it's awesome btw :+1:
Alright about setting the order of WebServerFactoryCustomizer
, I'd personally prefer a more specific way to use my own QueuedThreadPool
without relying on the order of customizers but both work I guess.
You can close this issue if you want or use it to add a UT, in all cases thanks for your help.