Spring JMX - 导出键值对的映射

发布于 2024-09-14 02:24:24 字数 85 浏览 4 评论 0原文

理想情况下使用 spring JMX 注释是否可以导出键值对的映射,其中键用作导出的属性名称?

如果是这样,怎么办?

谢谢。

Is it possible, ideally using the spring JMX annotations, to export a map of key value pairs where the key is used as the exported attribute name?

If so, how?

Thx.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云归处 2024-09-21 02:24:24

Spring 用于为给定 bean 构建 JMX 元数据的接口是 MBeanInfoAssembler。这是一个非常通用的接口,允许 JMX 本身支持的任何可能性,包括将任意映射公开为一组 JMX 属性。

然而,实现该接口是一件相当麻烦的事——JMX API 有点像猪。 Spring 提供了许多不同复杂性的实现,但它们都是围绕公开 javabean 风格的 Spring bean 进行的。即使是更通用的实现,AbstractMBeanInfoAssembler,也假设 getter 和 setter 来获取 JMX 属性值。

因此,您可以编写自己的MBeanInfoAssembler实现,但这会很困难。

The interface that Spring uses to build JMX metadata for a given bean is MBeanInfoAssembler. This is a very general inerface, allowing any possibility that JMX itself will support, including exposing an arbitrary map as a set of JMX attributes.

However, implementing that interface is quite a chore - the JMX API is a bit of a pig. Spring provides a number of implementations of various complexity, but they're all geared around exposing javabean-style Spring beans. Even the more generic of the implementations, AbstractMBeanInfoAssembler, assumes getters and setters to get the JMX attribute values.

So you could write your own implementation of MBeanInfoAssembler, but it's going to be difficult.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文