集成actuator
## 集成actuator实现优雅关闭应用
优雅停机主要应用在版本更新的时候,为了等待正在工作的线程全部执行完毕,然后再停止。我们可以使用SpringBoot提供的Actuator
1、pom.xml中引入actuator依赖
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
```
2、配置文件中endpoint开启shutdown
```
management:
endpoint:
shutdown:
enabled: true
endpoints:
web:
exposure:
include: "shutdown"
base-path: /monitor
```
3、在ShiroConfig中设置filterChainDefinitionMap配置url=anon
```java
filterChainDefinitionMap.put("/monitor/shutdown", "anon");
```
4、Post请求测试验证优雅停机 curl -X POST http://localhost:80/monitor/shutdown