springboot热布署

2019-05-12  本文已影响0人  激扬文字

springboot热布署

参考文档


image.png

https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-using-the-default-package
pom.xml配置

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

重启,之后修改代码,配置可以马上生效,除了静态资源目录中的文件,其他文件都可以进行修改并马上生效。使用部分文件不生效,可以在application.properties中添加配置
spring.devtools.restart.exclude=application.properties
这样application.properties进行修改后,就不会自动更新。

通过配置是否进行更新,通过触发器控制什么时候更新

spring.devtools.restart.trigger-file=trigger.txt

如trigger.txt初始值为1,如果需要更新,将1改成2即可进行更新。

改变服务访问端口

在application.properties 中添加配置
server.port= 8081,然后再启动。启动可生效

application.properties相关配置参考

image.png

https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#common-application-properties

上一篇下一篇

猜你喜欢

热点阅读