Intellij2017下springboot项目启动热部署功能
2017-12-19 16:48
405 查看
当我们修改了一个java类的时候,需要在修改后尽快看到效果是否实现,就需要用到热部署。它的原理是在发现代码有更改之后,重新启动应用,所以速度比手动停止后再启动更快。SpringBoot为我们提供了一个非常方便的工具spring-boot-devtools。因为devtools会监听classpath下的文件变动,所以当java类重新编译的时候,devtools会监听到这个变化,然后就会重新启动SpringBoot。这个重启是非常快的一个过程。因为在SpringBoot中有两个类加载器,一个是加载工程外部资源的,如jar包,还有一个类加载器是用来加载本工程的class的。所以在重启SpringBoot的时候只加载本工程的class文件。
pox.xml
在pom.xml中添加devtools工具的依赖,并修改设置
ctrl+shift+A 查找compiler(编译器) 勾选其中的 build project automatically(自动构建项目)
ctrl+shift+alt+/ 打开 maintenance(维修) 点击Registry(注册) 勾选Compiler.autoMake.allow.when.app.running
这样就可以实现热部署的功能了
pox.xml
在pom.xml中添加devtools工具的依赖,并修改设置
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin> </plugins> </build>
ctrl+shift+A 查找compiler(编译器) 勾选其中的 build project automatically(自动构建项目)
ctrl+shift+alt+/ 打开 maintenance(维修) 点击Registry(注册) 勾选Compiler.autoMake.allow.when.app.running
这样就可以实现热部署的功能了
相关文章推荐
- Intellij2017下springboot项目启动热部署功能
- SpringBoot web demo项目启动后立马自动关闭问题解决办法
- Spring Boot项目启动原理初探
- springboot项目修改启动端口
- 利用spring boot如何快速启动一个web项目详解
- 网关配置错误导致spring boot项目启动慢
- Spring Boot学习--项目启动时执行特定方法
- Spring Boot相关知识(二) Spring Boot项目启动的执行顺序和原理
- intelij idea 快速启动 springboot项目
- 常识-SpringBoot项目的启动方式
- intellij下将springboot项目打成war包发布到远程tomcat服务器上
- 从eclipse中导入到IDEA中的SpringBoot项目,启动时报错 Unable to start EmbeddedWebApplicationContext due to missing Em
- spring boot项目如何启动
- 把spring boot项目打war包放在tomcat下启动报错java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManage
- 使用Spring Boot框架maven项目新建后启动失败, 提示Unregistering JMX-exposed beans on shutdown
- spring boot 项目三种启动方式
- gradle构建的springboot项目的三种启动方式
- 使用IDEA启动在Eclipse中运行过的Springboot项目时翻车情况
- Spring Boot项目通用功能之《通用Service第一讲》
- intellij下将springboot项目打成war包发布到远程tomcat服务器上