Micronaut-core: Regression: micronaut.io.watch.restart not working

Created on 10 Jul 2020  路  8Comments  路  Source: micronaut-projects/micronaut-core

Task List

  • [x] Steps to reproduce provided
  • [ ] Stacktrace (if present) provided
  • [ ] Example that reproduces the problem uploaded to Github
  • [x] Full description of the issue provided (see below)

I just noticed that setting micronaut.io.watch.restart to true no longer works after migration to Micronaut 2.0.0.

Steps to Reproduce

  1. Set micronaut.io.watch.paths=src/mainand micronaut.io.watch.restart=true in application.yml.
  2. Run application
  3. Change source file under src/main - application won't terminate

Expected Behaviour

Application should terminate on source file change

Actual Behaviour

Application continues to run

Environment Information

  • Operating System: Windows 10
  • Micronaut Version: 2.0.0
  • JDK Version: 8
awaiting validation

All 8 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings