Search code examples
javaspringjmxmbeansspring-jmx

Exposing Collection<Something> from ManagedResource bean?


@ManagedResource
@Component
public class MyBean {
   Map<String, Something> map = new HashMap<String, Something>();

   @ManagedAttribute
   public Collection<Something> getFoo() {
       return map.values();
   }
}

The foo attributed shows as 'unavailable' in the visualvm mbeans tab. Why?


Solution

  • I annotated the bean with @MXBean then returned CompositeData[] creating instances of CompositeDataSupport.