会话(会话)
这会话端点提供由 Spring Session 管理的应用程序 HTTP 会话的信息。
检索会话
要检索会话,请获取请求/执行器/会话如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/sessions?username=alice' -i -X GET
前面的例子检索了用户名为爱丽丝.
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 789
{
"sessions" : [ {
"attributeNames" : [ ],
"creationTime" : "2025-11-20T14:33:59.914866807Z",
"expired" : false,
"id" : "40b429f0-57dd-4aeb-a5ad-241bea75fcb7",
"lastAccessedTime" : "2025-11-20T16:33:47.914867419Z",
"maxInactiveInterval" : 1800
}, {
"attributeNames" : [ ],
"creationTime" : "2025-11-20T04:33:59.914198661Z",
"expired" : false,
"id" : "13bd41f7-d039-4969-87bf-298833e7d86d",
"lastAccessedTime" : "2025-11-20T16:33:14.914204682Z",
"maxInactiveInterval" : 1800
}, {
"attributeNames" : [ ],
"creationTime" : "2025-11-20T11:33:59.914862470Z",
"expired" : false,
"id" : "4db5efcc-99cb-4d05-a52c-b49acfbb7ea9",
"lastAccessedTime" : "2025-11-20T16:33:22.914864303Z",
"maxInactiveInterval" : 1800
} ]
}
检索单个会话
要检索单个会话,请获取请求/actuator/sessions/{id}如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/sessions/4db5efcc-99cb-4d05-a52c-b49acfbb7ea9' -i -X GET
上述示例检索到包含身份证之4db5efcc-99cb-4d05-a52c-b49acfbb7ea9.
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 208
{"attributeNames":[],"creationTime":"2025-11-20T11:33:59.914862470Z","expired":false,"id":"4db5efcc-99cb-4d05-a52c-b49acfbb7ea9","lastAccessedTime":"2025-11-20T16:33:22.914864303Z","maxInactiveInterval":1800}
删除会话
要删除会话,请创建删除请求/actuator/sessions/{id}如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/sessions/4db5efcc-99cb-4d05-a52c-b49acfbb7ea9' -i -X DELETE
前述示例删除了包含身份证之4db5efcc-99cb-4d05-a52c-b49acfbb7ea9.