本文共 1731 字,大约阅读时间需要 5 分钟。
1.如何设置Spring Boot热部署?
之前SpringMVC系统自动执行热部署,只要改了Java文件,系统自动reload
SpringBoot热部署有很多种,这里讲的是devtools 而devtools不是自动reload,而是发现文件更改,自动重新启动服务器,节省了手动重启服务器的时间
步骤一:添加devtools的依赖jar包
org.springframework.boot spring-boot-devtools true
4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.5.RELEASE com.springboot.demo SpringBootDemoProject 0.0.1-SNAPSHOT SpringBootDemoProject Demo project for Spring Boot 13 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine org.springframework.boot spring-boot-devtools true org.springframework.boot spring-boot-configuration-processor true org.springframework.boot spring-boot-maven-plugin
步骤二:在src/main/resources下的 application.properties属性文件中配置devtool
#devtoolspring.devtools.restart.enabled=truespring.devtools.restart.additional-paths=src/main/java
转载地址:http://przqf.baihongyu.com/