82

I had wrote a project base on Spring-boot,tomcat,freemarker, I run it successful, but whenever I modify some templates and java class, I must restart server or use "reload changed classes" menu on Intellij to make the changes become effective. It wastes lots time!

Then I try to use springloaded as the official said:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>springloaded</artifactId>
            <version>1.2.0.RELEASE</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/springloaded-1.2.0.RELEASE.jar</systemPath>
        </dependency>
    </dependencies>
</plugin>

then I rerun server, but doesn't work as expected! I still need to restart server after any change on template or class.

How could I configure the springloaded to auto reload. Thanks a lot!


The version of Spring-boot is 1.3.0RC1

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.0.RC1</version>
</parent>

maven version:3.2 jdk:1.8 intellij :14.1.5 os:windows 8.1 64 bit

Partho
  • 2,153
  • 3
  • 17
  • 27
集成显卡
  • 1,433
  • 2
  • 13
  • 9

6 Answers6

178

First, be sure that you added spring-boot-devtools as dependency:

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

Second, verify that the option check-box File->Setting –> Build, Execution, Deployment –> Compiler–>Build project automatically is selected.

Last, press SHIFT+CTRL+A for Linux/Windows users or Command+SHIFT+A for Mac users, then type registry in the opened pop-up window. Scroll down to Registry... using the down arrow key and hit ENTER on Registry.... In the Registry window verify the option compiler.automake.allow.when.app.running is checked.

If the static files are not reloaded, press CTRL+F9 to force a reload.

The instructions above are taken from here

eli
  • 8,571
  • 4
  • 30
  • 40
Hocine Ben
  • 2,079
  • 2
  • 14
  • 20
  • 3
    Thanks it works, Do you know if its possible when running it with command line ? – Walterwhites Jan 19 '19 at 15:23
  • Its still not working. had it working for 5 other projects but you know f me right??? – Jp Silver Jul 21 '21 at 06:41
  • 1
    Do you know how to increase the speed? – Sami Feb 14 '22 at 20:35
  • 1
    Note that this has moved to the Advanced Settings: https://youtrack.jetbrains.com/issue/IDEA-274903/In-IntelliJ-2021.2-compiler.automake.allow.when.app.running-disappear.-Unable-to-enable-live-reload-under-Spring-boot#focus=Comments-27-5089338.0-0 – Michael Peterson Mar 06 '23 at 20:32
107

Note :: For who those not found that option in registry.The newer version of intellij idea for my case @Version:2021.2 the compiler.automake.allow.when.app.running option is moved to advanced settings:

enter image description here

Partho
  • 2,153
  • 3
  • 17
  • 27
24

For macOS

  1. Preference -> Compiler -> check "Build project automatically" asds

  2. shift + command + A enter image description here

enter image description here

check compiler.automake.allow.when.app.running

If the static files are not reloaded, press CTRL+F9 to force a reload.

checklist
  • 12,340
  • 15
  • 58
  • 102
Shuai Li
  • 2,426
  • 4
  • 24
  • 43
  • The registry item has moved to a checkbox in Advanced Settings: https://youtrack.jetbrains.com/issue/IDEA-274903/In-IntelliJ-2021.2-compiler.automake.allow.when.app.running-disappear.-Unable-to-enable-live-reload-under-Spring-boot#focus=Comments-27-5089338.0-0 – Michael Peterson Mar 06 '23 at 20:33
9

CTRL+F9 to make project with debugging. The idea is to make the project automatically work while not running or debugging!

Setting->Build->Compiler->check Make project automatically.

BradleyIW
  • 1,338
  • 2
  • 20
  • 37
wang.chun
  • 101
  • 1
  • 3
5

Possibly you could check if build is fired on any changes on Build Tools settings enter image description here

user5329403
  • 137
  • 2
  • 10
2

intelij reload

setting>>Build,Execution,Deployment>>Build Tools

any changes should be checked