Spring boot热加载

1.项目依赖添加spring-dev-tools

2.application.yml添加

spring:
  devtools:
    remote:
      secret: thisismysecret

3.在 Intellij IDEA 当中的 Preference -> Build, Execution, Deployment -> Compiler 中勾选 Build project automatically

4.在 IDEA 的 registry 中勾选 compiler.automake.allow.when.app.running (macOS 下使用 option + command + shift + / ,Windows 下使用 Ctrl + Alt + Shift + / 调出 registry 菜单)
然后寻找到 compiler.automake.allow.when.app.running,进行勾选

最后重启 IDE,在 Run/Debug Configurations 中新建一个 Spring Boot 模板的配置。其中 Main Class 填入 org.springframework.boot.devtools.RemoteSpringApplication (注意哦,点右边的省略号按钮勾选 include non-project classes 的选择才有效)。然后在 Program arguments 中填入服务地址,比如你的服务端口是 8080 就填 http://localhost:8080; Working Directory 填写 MODULE_DIR,而 Use classpath of module 选择当前项目即可。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容