Description
When I use devtools reloading on a reactive application (webflux) it results in much slower restart times.
Minimal reproducer is here
It's a sample application returning a string response.
I don't know how to trigger devtools properly from the command line, so I do it from the IDE by changing a String value in the controller class.
You can run the app with: ./mvnw spring-boot:run
and opening http://localhost:8080/greeting/Oleg
.
The app starts very fast -- on my machine Started DemoApplication in 0.65 seconds (JVM running for 0.992)
.
When I trigger a reload, the app is stopping for 2s during the reload process. In the debug logs I see:
2022-01-21 21:15:15.545 DEBUG 96273 --- [ Thread-5] o.s.boot.devtools.restart.Restarter : Stopping application
2022-01-21 21:15:15.545 DEBUG 96273 --- [ Thread-5] o.s.b.a.ApplicationAvailabilityBean : Application availability state ReadinessState changed from ACCEPTING_TRAFFIC to REFUSING_TRAFFIC
2022-01-21 21:15:15.545 DEBUG 96273 --- [ Thread-5] onfigReactiveWebServerApplicationContext : Closing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@5a555b15, started on Fri Jan 21 21:14:48 EET 2022
2022-01-21 21:15:15.550 DEBUG 96273 --- [ Thread-5] ySourcesPropertyResolver$DefaultResolver : Found key 'spring.liveBeansView.mbeanDomain' in PropertySource 'systemProperties' with value of type String
2022-01-21 21:15:17.691 DEBUG 96273 --- [ Thread-5] o.s.b.d.r.c.RestartClassLoader : Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@63aaaaf3
Closing at 15.545
and created new classloader at 15:17.691
.
Affecter SpringBoot version is 2.6.3, it also reproduces on 3.0.0-M1
.