首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MBeans未在jvisualVM中显示

MBeans未在jvisualVM中显示
EN

Stack Overflow用户
提问于 2016-06-09 19:07:00
回答 1查看 1.5K关注 0票数 2

加里·拉塞尔的监测弹簧集成应用程序很棒。

我想添加简单的MBean来监视应用程序。这是我的代码:

代码语言:javascript
复制
package com.example;

import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;

@Component
@ManagedResource(objectName="myapp:application=hello")

public class HelloBean {

    @ManagedOperation
    public String sayHello(String name) {
       return "Hello " + name;
    }
}

我还在spring上下文xml文件中添加了以下内容:

代码语言:javascript
复制
<context:mbean-server />
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application" />

<bean id="helloBean" class="com.example.HelloBean" />

当我看jVisualVM时,我没有看到豆子。我可以在MessageChannel域中看到spring.application,但看不到我的MBean。

为了让带注释的MBeans在visualVM中显示,还有什么事情要做吗?

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-09 19:22:16

<context:mbean-export/>是给你的。

<int-jmx:mbean-export>是Spring组件的自定义MBeanExporter。其他一切都应该由标准的Spring<context:mbean-export/>来管理。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37734269

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档