SpringBoot基于Actuator远程关闭服务
1、在pom.xml文件引入依赖
<!-- 运行状态监控actuator依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
2、配置文件配置
server: port: 8100 #web服务端口 servlet: context-path: /buzhengspring: 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### 运行状态监控Actuatormanagement: server: port: 9011 #运行状态监控端口 endpoints: web: exposure: include: '*' base-path: / #配置可远程使用 Actuator 关闭服务 endpoint: shutdown: #关闭服务 enabled: true
3、执行关闭指令
http://localhost:9011/shutdown POST请求
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持好吧啦网。
相关文章:
1. ASP.NET MVC把数据库中枚举项的数字转换成文字2. asp.net core 中的Jwt(Json Web Token)的使用详解3. 浅析Python requests 模块4. JavaScript实现浏览器网页自动滚动并点击的示例代码5. Ajax请求超时与网络异常处理图文详解6. Spring Boot2.x集成JPA快速开发的示例代码7. 2020最新IDEA SpringBoot整合Dubbo的实现(zookeeper版)8. WML的简单例子及编辑、测试方法第1/2页9. AJAX实现数据的增删改查操作详解【java后台】10. python pytesseract库的实例用法

网公网安备