热部署是不用 Ctrl + F9 的!!! 告诉你 Ctrl + 9 你就怼他吧,没错的!
- 正题
- pom 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>true</scope>
<optional>true</optional>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 没有该配置,devtools 不生效 -->
<fork>true</fork>
<addResources>true</addResources>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2 . idea 配置
打开 File -> Settings ->Build,Executions,Deployment -> Compiler ,勾选
然后,Ctrl + Shift + Alt + \ 打开
然后勾选
这一步很多人忘记设置。。所以导致不成功!!!
3.缓存配置
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML
encoding: utf-8
servlet:
content-type: text/html
cache: false