- 在pom.xml配置文件中加入依赖:
<!-- 热部署依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
2.在插件plugins中,配置fork为true
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--开启热部署-->
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
3.对于thymeleaf的修改,需要把缓存给关闭,才可以看见效果。
thymeleaf:
mode: HTML5
encoding: UTF-8
content-type: text/html
#开发时关闭缓存,不然没法看到实时页面
cache: false
cache-period: 0
template:
cache: false
4..开启自动编译功能
5.可以进行测试。