美文网首页
springboot热布署

springboot热布署

作者: 激扬文字 | 来源:发表于2019-05-12 01:54 被阅读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

    相关文章

      网友评论

          本文标题:springboot热布署

          本文链接:https://www.haomeiwen.com/subject/jvkqaqtx.html