Spring JMX - 导出键值对的映射
理想情况下使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.