【问题标题】:Getting Spring Session information from Spring Actuator从 Spring Actuator 获取 Spring Session 信息
【发布时间】:2016-05-16 17:19:50
【问题描述】:

我有一个基于 Spring Cloud 的应用程序,将 Spring 会话存储在 Redis 中。它使用带有嵌入式 tomcat 的 Spring Boot。

使用弹簧执行器时,/metrics 端点不会返回任何有价值的信息。 httpsessions.active 设置为 0,httpsessions.max 设置为 -1。

我猜这是因为 spring 用自己的 spring session 实现替换了 httpsession 实现。

有没有办法从某个端点访问这些信息?最好使用 JMX,但不是强制性的。

谢谢。

【问题讨论】:

  • 这是唯一的workaround I have found。对于 spring boot 执行器来实现这种功能会很好,因为在 spring boot 应用程序中启用 tomcat 管理器似乎是no easy way

标签: spring-boot spring-session spring-data-redis spring-boot-actuator


【解决方案1】:

我最终通过使用通用用户名使用了以下解决方案。端点将返回所有会话,一个简单的计数将给出总数。

http://docs.spring.io/spring-session/docs/current/reference/html5/guides/findbyusername.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 2020-02-17
    • 2020-02-19
    • 1970-01-01
    • 1970-01-01
    • 2017-05-01
    • 2011-04-22
    相关资源
    最近更新 更多