SpringBoot热部署

来源:互联网 发布:奶酪陷阱 知乎 编辑:程序博客网 时间:2024/06/05 19:40

本篇所谓的 SpringBoot热部署,是为了代码修改,命令行的mvn spring-boot:run能够自动发布、重启。


操作要点:修改配置文件pom.xml,仅下面2步即可

1、在依赖包中增加devtools引用

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional></dependency>
2、在build的plugins增加springloaded插件

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><dependencies><!-- spring热部署 --><dependency><groupId>org.springframework</groupId><artifactId>springloaded</artifactId><version>1.2.6.RELEASE</version></dependency></dependencies></plugin></plugins></build>




2 0