SpringBoot系列教材 (三十六)- Thymeleaf - 在 idea2017 里 springboot thymeleaf 修改 html 之后不能立即看到效果的解决办法

步骤1:idea 热更新
步骤2:pom.xml
步骤3:idea 设置
步骤4:1. 项目自动编译
步骤5:2. automake 选项开启-A
步骤6:2. automake 选项开启-B

步骤 1 : idea 热更新

在 idea2017 里, springboot thymeleaf 修改 html 之后不能立即看到效果,要重新启动 Application 才可以看到效果。 这样做开发效率肯定是大受影响的。
本知识点讲解如何进行相关设置,以达到修改 html 之后,马上就可以看到效果。

步骤 2 : pom.xml

首先要确保 pom.xml 里有热部署的依赖和插件:
做法很简单,在pom.xml中新增加一个依赖和一个插件就行了。
依赖:

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-devtools</artifactId>

    <optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->

</dependency>


插件:

<plugin>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-maven-plugin</artifactId>

</plugin>


这一点在前面的 热部署 教程里已经有讲解了。

步骤 3 : idea 设置

然后是 idea 设置。
设置两个内容:
1. 项目自动编译
2. automake 选项开启

步骤 4 : 1. 项目自动编译

菜单 -> Other Settings -> Default Settings -> Builld, Execution, Deployment -> Compiler
勾选其中的 Build project automatically. 这个选项默认是没有被勾选的。

1. 项目自动编译

步骤 5 : 2. automake 选项开启-A

automake 选项开启比较麻烦,因为它的开启界面默认是不能够被打开的,需要通过快捷键才能打开。。。

设置快捷键办法:
1. 菜单->File->Settings->左上角的搜索框里输入 Registry
2. 右边搜索结果出现 Registry... 这么一个功能,然后给这个功能增加一个快捷键 Alt+Shift+M。 用这个快捷键是因为它默认情况下是没有冲突的。
3. 点击 OK
继续下一步

2. automake 选项开启-A

步骤 6 : 2. automake 选项开启-B

然后通过 Alt+Shift +M 快捷键打开 Registry 窗口,找到 如图所示的 comipler.automake.allow.when.app.running 勾上。
然后点 Close.
接着重启 idea, 这样修改 html 就可以马上看到效果了

2. automake 选项开启-B


更多内容,点击了解: https://how2j.cn/k/springboot/springboot-idea-hot-deploy/1923.html

  • 24
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值