Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make auto reload with Spring-boot on IDEA Intellij

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

like image 884
集成显卡 Avatar asked Oct 26 '15 15:10

集成显卡


People also ask

Does IntelliJ have Spring Initializr?

IntelliJ IDEA provides the Spring Initializr project wizard that integrates with the Spring Initializr API to generate and import your project directly from the IDE.

How do I enable auto reload of my Spring Boot Mcq?

26) How can you enable auto reload of application with Spring Boot? You can enable auto-reload/LiveReload of spring boot application by adding the spring-boot-devtools dependency in the pom. xml file.


2 Answers

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

like image 170
Hocine Ben Avatar answered Sep 20 '22 08:09

Hocine Ben


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

like image 26
Partho Avatar answered Sep 21 '22 08:09

Partho