一)、使用spring提供的devtools
Spring Boot提供了一个名为spring-boot-devtools的模块来使应用支持热部署,提高开发者的开发效率,无需手动重启Spring Boot应用。虽然平时开发web项目过程中,改动项目启重启总是报错;但springBoot对调试支持很好,修改之后可以实时生效,需要添加以下的配置:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
#热部署生效:在配置文件application.yml中添加 :
debug: true
spring:
devtools:
restart:
enabled: true
#设置开启热部署
freemarker:
cache: false
#页面不加载缓存,修改即时生效
最后
以上就是刻苦手机最近收集整理的关于SpringBoot开发热部署(无需重启应用)的全部内容,更多相关SpringBoot开发热部署(无需重启应用)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复