1 Introduction
All along, the idea to do web development using modified html, after jsp, js files, you must manually re-deploy tomcat, we have to wait a minimum of 6-10 seconds,
Even sometimes not able to find a compiler error file, recompile the entire project, then have to wait 15 seconds
too slow! ! ! ! ! !
2. solve
Use hot deployment! ! ! ! The idea is also cool than hot deployment eclipse, eclipse the need to save in order to have a web browser to refresh the modified data, save it directly to step omitted,
Advantage is that the source code can be revoked yard line and experience super good! ! !
3. Turn on the specific process hot deployment
(1)
pom.xml file dependencies added, does not require high version, the new version dependencies are generally not stable
[Must find their own dependencies, although spring is provided with a built-use, but very old, will prompt a lot of warning, obsessive-compulsive disorder is not recommended, of course, use the built-in spring you can ignore this first step]
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <version>2.0.4.RELEASE</version> </dependency>
(2) pom.xml inside Compiled way
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin>
(3) setting configuration steps: File >> Settings >> Build, Execution, Deployment >> Compiler,
Hook "" Build project automatically "this box, save
(4) Press ctrl + alt + shift + /, select the first Registry
Will open a new page, check this box, then click the lower right corner to save close
(5) Editing tomcat
Use war_exploded this package, do not use war package
两个选项都选update classes and resourses ,保存
(6)关闭浏览器的缓存文件功能,我是使用谷歌的chome
那么就把disable cache勾选 ,其他浏览器也需要关闭的,这里就不展示。
(7)重启 idea 即可使用
4.使用方法
测试:
(1)idea部署
(2)浏览器展示截图:
(3)直接修改html文件内容
(4)直接打开浏览器,刷新页面 ,即可看到修改后的内容
(5)实现原理
基本上是瞬间刷新,是不是很方便,但是不建议在大型项目使用,
热部署其实根本原理 还是要部署项目,只是由软件自动给部署了,
当idea软件失去焦点的时候,会自动更新部署内容,中小项目还好,
大型项目会有延迟,但是总比手动好对不?
还是根据需要来使用最佳。