search

Home  >  Q&A  >  body text

java - idea能不能像STS那样直接通过保存快速重启Spring Boot项目

在Spring Boot项目添加了devtools的前提下,STS只需要简单的保存文件就可以触发重启,非常方便简单。但是Intellij IDEA还需要Ctrl+F9构建项目才行,而且如果使用Gradle的话会调用gradle的build任务,速度更慢,调试体验很受影响。请问有什么插件之类的可以让idea像STS那样保存文件就可以快速触发Spring Boot的重启吗?

另外其实如果Gradle守护进程活着的话Gradle构建也并不算慢。但是不知道是不是我内存捉急的原因,gradle守护经常这次构建,创建了守护进程,然后过几分钟守护进程就死了。之后下次构建项目还得重新启动守护进程,无形中浪费了几十秒时间。有没有啥办法能让Gradle deamon活得久一点?

巴扎黑巴扎黑2805 days ago627

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-18 10:58:15

    Gradle has not been studied, let me tell you how to operate it using maven, and the subject of the question can draw inferences

    First step

    Introducing spring devtools

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>

    Step 2

    Turn on automatic compilation

    Step 3

    Press ctrl + shift + a on the idea interface and search for registry

    Step 4

    Open compiler.automake.allow.when.app.running

    Step 5

    Enjoy the pleasure of debugging again
    You can even install a plug-in for chrome to automatically refresh the page when the page is modified

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:58:15

    @FullStackDeveloper's method can only do simple hot swap.
    If you want to do real hot deployment, you can use JRebel.

    1. Install JRebel plugin in Intellij

    2. Go to MyJRebel to get the registration code (this registration code is provided to the open source community for free)

    3. Fill in the registration code and then use JRebel to launch your application.
      Every time you change the code, just rebuild it.


    ]

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 10:58:15

    reply
    0
  • Cancelreply