2

我的 MBean 使用 Spring 注释进行注释,如下所示:

@ManagedAttribute(description = "returns the name")
    public String getName() {
        return name;
    }

现在,每当我打开 JMX 控制台(无论是 VisualVM 还是 JConsole)时,我都可以在 Attributes 选项卡中看到我的 bean 的属性,但我也可以在 Operations 选项卡中看到 getName() 方法。有没有办法让我只能在“属性”选项卡中看到该属性(即从“操作”选项卡中隐藏它)?

4

1 回答 1

2

AbstractReflectiveMBeanInfoAssembler自 2008 年以来就有以下代码:

// Attributes need to have their methods exposed as
// operations to the JMX server as well.

如果您看到 的描述符部分javax.management.modelmbean.ModelMBeanOperationInfo,您会看到有参数role=gettervisibility=4,它们应该(取决于显示属性/操作的应用程序)以某种方式隐藏。

在https://jira.spring.io/browse/SPR-4232下查看更多详细信息。

于 2015-12-03T17:54:13.057 回答