spring boot 實現優雅的關閉


1、導入jar包

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
                <version>2.1.3.RELEASE</version>
            </dependency>

2、yml文件配置

    # 啟用shutdown
management:
  endpoint:
    shutdown:
      enabled: true
      # 公開所有的端點
  endpoints:
    web:
      exposure:
        include: '*'

3、使用方法

使用方法:Windows + R   cmd
curl -XPOST http://localhost:port/context-path/actuator/shutdown

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM