Spring Boot devtools开发者工具热部署

The spring-boot-devtools module provides additional development-time features such as automatic restarts, for a smoother application development experience. Developer tools are automatically disabled when running a fully packaged application.

额外的开发期间的特性如:自动重启

引入maven依赖:

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

修改IDEA配置:

 然后Shift + Alt + Command + / 弹出(windows Shift + Ctrl + Alt + /):

 选择Maintenance中的Registry,这里都是一些危险的修改,除非你知道自己在做什么否则不要轻易修改。

 现在Java类的改动会让应用自动重启。

 

使用dev-tools热部署会快很多的原因:应用本身的class和第三方的jar分两个类加载器加载,因为应用的class会经常发生修改,而第三方的jar不会被修改,所以热部署时只会重新加载应用本身的类,数量会少很多,速度也就会加快。 

 
原文地址:https://www.cnblogs.com/fubinhnust/p/12013814.html