Intellij IDEA – Spring boot reload static file is not working

摘要: In Eclipse, just include the Spring Boot Dev Tools dependency, then the hot swapping and static file reload will be enabled magically. For Intellij IDE, we need extra steps to enable it.

In Eclipse, just include the Spring Boot Dev Tools dependency, then the hot swapping and static file reload will be enabled magically. For Intellij IDE, we need extra steps to enable it.

1. Spring Boot Dev Tools

With Spring Boot Dev Tools enabled :

  • Any changes to views or resources can be seen in the browser directly, no need restarts, just refresh the browser.
  • Any changes to the code that will restart the Spring container automatically.

First, include the Spring Boot Dev Tools dependency :

pom.xml
  <!-- hot swapping, enable live reload -->
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
  </dependency>

2. Build Project Automatically

File –> Setting –> Build, Execution, Deployment –> Compiler –> check this Build project automatically

3. Intellij Registry

3.1 Press SHIFT+CTRL+A (Win/*nix) or Command+SHIFT+A (Mac) to open a pop-up windows, type registry

3.2 Find and enabled this option compiler.automake.allow.when.app.running

Done. Now, the hot swapping & static files auto reload should be enabled.

In Menu -> Build -> Build Project (CTRL + F9)
If the static files are not reloaded, press CTRL+F9 to force a reload.

上一篇: iText Read and Write PDF in Java
下一篇: Spring Boot Which main class to start
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号