SpringBoot基于Actuator遠(yuǎn)程關(guān)閉服務(wù)
1、在pom.xml文件引入依賴
<!-- 運(yùn)行狀態(tài)監(jiān)控actuator依賴 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2、配置文件配置
server:
port: 8100 #web服務(wù)端口
servlet:
context-path: /buzheng
spring:
main:
allow-bean-definition-overriding: true #是否允許使用相同名稱重新注冊(cè)不同的bean實(shí)現(xiàn). 默認(rèn)是允許
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: asdfghjkl
### 運(yùn)行狀態(tài)監(jiān)控Actuator
management:
server:
port: 9011 #運(yùn)行狀態(tài)監(jiān)控端口
endpoints:
web:
exposure:
include: "*"
base-path: /
#配置可遠(yuǎn)程使用 Actuator 關(guān)閉服務(wù)
endpoint:
shutdown: #關(guān)閉服務(wù)
enabled: true
3、執(zhí)行關(guān)閉指令
http://localhost:9011/shutdown POST請(qǐng)求
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
詳解Spring 框架中切入點(diǎn) pointcut 表達(dá)式的常用寫法
這篇文章主要介紹了詳解Spring 框架中切入點(diǎn) pointcut 表達(dá)式的常用寫法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-04-04
java基于jedisLock—redis分布式鎖實(shí)現(xiàn)示例代碼
這篇文章主要介紹了jedisLock—redis分布式鎖實(shí)現(xiàn)示例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-11-11
淺談Spring Boot 2.0遷移指南主要注意點(diǎn)
Spring官方的Spring Boot 2變動(dòng)指南,主要是幫助您將應(yīng)用程序遷移到Spring Boot 2.0,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-10-10
關(guān)于spring data jpa一級(jí)緩存的問題
這篇文章主要介紹了關(guān)于spring data jpa一級(jí)緩存的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11
Springboot多數(shù)據(jù)源配置之整合dynamic-datasource方式
這篇文章主要介紹了Springboot多數(shù)據(jù)源配置之整合dynamic-datasource方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-03-03
FeignClient設(shè)置動(dòng)態(tài)url方式
文章介紹了如何在Spring Cloud環(huán)境下使用FeignClient實(shí)現(xiàn)負(fù)載均衡,通過配置Nacos和FeignClient屬性,可以實(shí)現(xiàn)服務(wù)間的負(fù)載均衡調(diào)用2024-11-11

