springboot之热部署
在springboot的热部署中我的环境采用的idea编辑器测试的
1.首先在pom文件中配置热部署的依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency>
2.再在yml属性文件中配置 thymeleaf cache不缓存
spring: thymeleaf: prefix: classpath:/templates/ suffix: .html mode: HTML5 encoding: utf-8 servlet: content-type: text/html cache: false
3.进过测试发现后台修改过后确实已经有重启的日志在打印了。可是访问thymeleaf模板文件修改的内容却没有动态的修改过来
到底是什么原因的。经过查资料和测试发现了是idea编辑器的问题
4.idea没有动态修改主要有两个原因
一: 使用快捷键 ctrl+shift+a 调出窗口 然后搜索registry 点击选中
在弹出的选项中选中 compile.automake.allow.when.app.running 勾选上
二:还需要ctrl+alt + s 设置Build,Excution,Deployment下的compile菜单中的Build project automatically
此时修改后台代码后 前台thymeleaf模板就可以动态的显示啦!这样就不用每次都(ctrl+F9)来动态显示模板内容