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. Python中的min及返回最小值索引的操作2. Python常用base64 md5 aes des crc32加密解密方法汇总3. Python使用Socket实现简单聊天程序4. js中textContent、innerText和innerHTML的用法以及区别5. Python+Appium实现自动抢微信红包6. Android如何用自定义View实现雪花效果7. springboot使用CommandLineRunner解决项目启动时初始化资源的操作8. Python操作MongoDb数据库流程详解9. SpringBoot框架打包体积简化过程图解10. Vue中强制组件重新渲染的正确方法

网公网安备