I just noticed that setting micronaut.io.watch.restart to true no longer works after migration to Micronaut 2.0.0.
micronaut.io.watch.paths=src/mainand micronaut.io.watch.restart=true in application.yml.src/main - application won't terminateApplication should terminate on source file change
Application continues to run
This is definitely working however enabled by default in build.gradle ... all you have to do now is run ./gradlew run -t
This is strange, for me this is not working anymore. I have been using this with 1.x all the time, but since upgrading to 2.0.0 my apps won't stop if I save a modified source file.
Maybe a problem with the file change detection on Windows?
Where is the code for this feature located in the project? Maybe I can find the reason why it's not working anymore on Windows.
The thing that stops the server is this:
The thing that watches files is this:
I found the reason: the feature now requires the property micronaut.io.watch.enabled to be set to TRUE. This is probably caused by the following DefaultWatchThread annotation:
@Requires(property = FileWatchConfiguration.ENABLED, value = StringUtils.TRUE, defaultValue = StringUtils.TRUE)
The code has not changed since Micronaut 1.x. Maybe the property evaluation has changed somehow in 2.0?
Don't believe so
@esocode looks like I fell down the same rabbit hole as you! I wound up with the exact same conclusion.
I've raised PR #4554 to include enabled: true in the docs.