idea thymeleaf 热更新

1. **添加依赖**(jeecgboot框架这步省略,不然报错):
   确保在 `pom.xml` 中添加了 `spring-boot-devtools` 依赖:

   ```xml
   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-devtools</artifactId>
   </dependency>
   ```

2. **禁用Thymeleaf缓存**:
   在 `application.properties` 文件中配置:

   ```properties
   spring.thymeleaf.cache=false
   spring.thymeleaf.prefix=classpath:/templates/
   spring.thymeleaf.suffix=.html
   spring.thymeleaf.mode=HTML
   spring.thymeleaf.encoding=UTF-8
   spring.thymeleaf.servlet.content-type=text/html
   ```

3. **启用Spring Boot DevTools**(jeecgboot框架这步省略,):
   在 `application.properties` 中配置:

   ```properties
   spring.devtools.restart.enabled=true
   spring.devtools.livereload.enabled=true
   ```

4. **配置IDEA的自动编译**:
   - 打开Settings/Preferences(按下 `Ctrl + Alt + S`)。
   - 导航到 `Build, Execution, Deployment` -> `Compiler`。
   - 勾选 `Build project automatically`。

     ![Build project automatically](https://img.jetbrains.com/help/idea/buildProjectAutomatically.png)

   如果你没有看到 `Allow auto-make to start even if developed application is running` 选项,确保下面的步骤:

5. **设置自动保存**:
   - 打开Settings/Preferences(按下 `Ctrl + Alt + S`)。
   - 导航到 `Appearance & Behavior` -> `System Settings`。
   - 确保 `Save files on frame deactivation` 和 `Save files automatically if application is idle for ... seconds` 被勾选。

     ![Save files automatically](https://img.jetbrains.com/help/idea/saveFilesAutomatically.png)

6.修改配置

7.每次修改完内容在idea Ctrl+F9(编译项目)然后刷新浏览器即可看到修改后的内容

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值