1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| 1.POM文件增加 ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> ...
2.配置application.yml文件: management: server: # 禁止外部调用 address: 127.0.0.1 # 自定义端口,必须设置和服务不同的端口,否则上面自定义address失效 port: 9090 endpoint: shutdown: enabled: true endpoints: web: exposure: #公开所有端点 include: "*" 3.发送**post**请求,"ip:port/actuator/shutdown"请求关闭
|