Loading... 在IntelliJ IDEA中配置HTML和Thymeleaf热部署,可以让你在开发过程中实时看到代码的变化,而无需每次都重新启动应用。下面是具体的步骤: 步骤一:打开IDEA,选择你的项目。 步骤二:在顶部菜单栏中,选择“File” -> “Settings”。 步骤三:在弹出的设置窗口中,选择“Build, Execution, Deployment” -> “Compiler”。 步骤四:在右侧的“Build project automatically”选项前打勾,这样IDEA就会在你保存文件时自动编译项目。 步骤五:然后,按下“Shift”键连续两次,打开搜索框,输入“Registry”。 步骤六:在弹出的“Registry”窗口中,找到“compiler.automake.allow.when.app.running”选项,确保它被选中。 至此,你已经完成了IDEA的自动编译配置。接下来,我们需要配置Spring Boot的热部署。 步骤七:在项目的pom.xml文件中,添加以下依赖: ```xml <dependencies> <!-- 省略其他依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> </dependencies> ``` 步骤八:然后,在application.properties或者application.yml文件中,添加以下配置: ```properties # application.properties spring.thymeleaf.cache=false ``` 或者 ```yaml # application.yml spring: thymeleaf: cache: false ``` 这样,Thymeleaf模板引擎就不会缓存视图,每次请求都会重新渲染视图。 步骤九:最后,重启你的应用。现在,当你修改HTML或Thymeleaf模板时,只需要刷新浏览器就可以看到最新的结果。 以上就是在IntelliJ IDEA中配置HTML和Thymeleaf热部署的步骤。这样的配置可以大大提高你的开发效率,让你更专注于代码的编写,而不是等待应用的重启。希望这个指南对你有所帮助! #### [云服务器推荐](https://www.tsyvps.com/) #### [蓝易云](https://www.tsyvps.com/)国内/海外高防云服务器推荐 <div class="preview"> <div class="post-inser post box-shadow-wrap-normal"> <a href="https://www.tsyvps.com" target="_blank" class="post_inser_a no-external-link no-underline-link"> <div class="inner-image bg" style="background-image: url(https://www.8kiz.cn/img/6.png);background-size: cover;"></div> <div class="inner-content" > <p class="inser-title">蓝易云-五网CN2服务器【点我购买】</p> <div class="inster-summary text-muted"> <span style='color: red;'>蓝易云采用KVM高性能架构,稳定可靠,安全无忧!<br>蓝易云服务器真实CN2回国线路,不伪造,只做高质量海外服务器。</span> </div> </div> </a> <!-- .inner-content #####--> </div> <!-- .post-inser ####--> </div> --- **<span style='color:#000000'>海外免备案云服务器链接:[www.tsyvps.com](https://www.tsyvps.com)</span>** **<span style='color:#DC143C'>持有增值电信营业许可证:B1-20222080【资质齐全】</span>** **<span style='color:#DC143C'>蓝易云香港五网CN2 GIA/GT精品网络服务器。拒绝绕路,拒绝不稳定。</span>** --- #### **百度搜索:[蓝易云](https://www.baidu.com/s?ie=UTF-8&wd=%E8%93%9D%E6%98%93%E4%BA%91)** 最后修改:2023 年 11 月 01 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏