`

使用springboot-devtools进行热部署

阅读更多
使用springboot-devtools进行热部署

(1)添加devtools的依赖配置
<dependency><groupid>org.springframework.boot</groupid><artifactid>spring-boot-devtools</artifactid><optional>true</optional><scope>true</scope></dependency>

(2)需要加入spring-boot-maven-plugin
<plugin><groupid>org.springframework.boot</groupid><artifactid>spring-boot-maven-plugin</artifactid><configuration><!-- 如果没有该项配置,devtools不会起作用 --><fork>true</fork></configuration></plugin><properties><project.build.sourceencoding>UTF-8</project.build.sourceencoding><project.reporting.outputencoding>UTF-8</project.reporting.outputencoding><java.version>1.8</java.version></properties>



如果您需要完全禁用重新启动支持,则需要在调用SpringApplication.run(...)之前将spring.devtools.restart.enabled 系统属性设置为false,
如以下示例所示:
System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(MyApp.class, args);

将 spring.devtools.restart.exclude 设置为如下可排除对
/static,/public 目录的restart监测。

spring-boot-devtools模块包含一个嵌入式LiveReload服务器,当资源发生变化时,可用于触发浏览器刷新。 LiveReload浏览器扩展支持的Chrome,Firefox和Safari,可从livereload.com免费获得。
如果您不想在应用程序运行时启动LiveReload服务器,则可以将spring.devtools.livereload.enabled属性设置为false
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics