tags:

views:

36

answers:

1

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.

+1  A: 

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.

skaffman