SpringBoot基于Actuator远程关闭服务

这篇文章主要介绍了SpringBoot基于Actuator远程关闭服务,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

1、在pom.xml文件引入依赖

  org.springframework.bootspring-boot-starter-actuator

2、配置文件配置

 server: port: 8100 #web服务端口 servlet: context-path: /buzheng spring: main: allow-bean-definition-overriding: true #是否允许使用相同名称重新注册不同的bean实现. 默认是允许 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 ### 运行状态监控Actuator management: server: port: 9011 #运行状态监控端口 endpoints: web: exposure: include: "*" base-path: / #配置可远程使用  Actuator 关闭服务 endpoint: shutdown: #关闭服务 enabled: true

3、执行关闭指令

http://localhost:9011/shutdown POST请求

以上就是SpringBoot基于Actuator远程关闭服务的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » Java