0
点赞
收藏
分享

微信扫一扫

解决了Idea SpringBoot devtools的热部署

楚木巽 2022-03-22 阅读 91

文章目录

解决了Idea SpringBoot devtools的热部署

说起这次解决idea,也是花费了不少功夫,在阅读SpringBoot参考文档的时候,读到了springBoot devtools的配置问题,但是,最后解决是在看了idea的官方文档的时候解决了

https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using

Some IDEs have features that save you from needing to update your trigger file manually. Spring Tools for Eclipse and IntelliJ IDEA (Ultimate Edition) both have such support. With Spring Tools, you can use the “reload” button from the console view (as long as your trigger-file is named .reloadtrigger). For IntelliJ IDEA, you can follow the instructions in their documentation.

  • 在读到这一段文字的时候,我跳转到了idea配置,因为我用的是idea2019.3的版本,我选择了对映的文档

    https://www.jetbrains.com/help/idea/2019.3/spring-boot.html#configure-application-update-policies-with-devtools
    在这里插入图片描述

Configure application update policies with devtools
With the spring-boot-devtools module, your application will restart every time files on the classpath change. However, if you want your application to restart only at specific moments, you can set a trigger file. In this case your application will restart only after you modify the trigger file.

IntelliJ IDEA provides more options for updating a running application. After you enable the devtools, the Update Application Update application option Ctrl+F10 becomes available on the left frame of the Services tool window, in the Run/Debug tool window, and from the main menu (Run | Update Application). Depending on your needs, you can configure what the IDE will do after you click this option.

You can create several run/debug configurations with different update policies and switch between them.

From the main menu, select Run | Edit Configurations.

Select the necessary Spring Boot configuration, or create a new one (click Add icon and select Spring Boot icon Spring Boot).

Specify the main class that this configuration must be applied to.

From the On ‘Update’ action list, select a policy. You can update resources only, update classes and resources (build your application), update the trigger file (restart), or perform a class hot swap, and if it fails, IntelliJ IDEA will update the trigger file (restart).

From the On frame deactivation list, you can also select an action that the IDE will do after you switch to another application. IntelliJ IDEA can update resources, or build your application.

在这里插入图片描述

  • 按照如上的配置就可以配置好了热部署
    2s5d0-1647957881543)]

在这里插入图片描述

  • 按照如上的配置就可以配置好了热部署
  • 按照操作步骤操作,就可以热部署了,相对于网上的版本,我看的这个版本不需要开启后台registry,idea配置类的compiler也不需要勾选🆗
举报

相关推荐

0 条评论