Spring boot devtools - Static content reloading does not work in IntelliJ

后端 未结 4 984
小鲜肉
小鲜肉 2020-12-12 14:19

When building my first Spring Boot app, I discovered that I need to restart my app every time I make a change to a Javascript file in /resources/static/some-file.js

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 15:13

    You need to turn on a couple of features in IntelliJ to make this work.

    First, there's a project specific setting which you would need to apply on any project you want to use devtools in. Go to Preferences > Compiler and enable "Make project automatically."

    The next setting is an IDEA registry setting that applies to all projects.

    • In macOS (OSX), press Shift+Command+A (Shift+Ctrl+A in Windows)
    • Type "Registry" in the search box that appears, and select the registry to open it.
    • Lookup compiler.automake.allow.when.app.running and enable it.

    After that, restart your app. You will notice that the project keeps rebuilding with every change you make. When you check out the result in the browser, you will see both static files and code have been updated.

提交回复
热议问题