java - MBean 未显示在 jvisualVM 中

标签 java spring-integration mbeans spring-jmx

Gary Russels's Monitoring Spring Integration应用很棒。

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

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-context xml 文件中添加了以下内容:

<context:mbean-server />
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application" />

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

当我查看 jVisualVM 时,我没有看到该 bean。我可以在 spring.application 域中看到 MessageChannel,但看不到我的 MBean。 image of MBeans in spring.integration

是否还需要做其他事情才能让带注释的 MBean 在 VisualVM 中显示?

谢谢。

最佳答案

<context:mbean-export/>适合你。

<int-jmx:mbean-export>是定制MBeanExporter用于 Spring 集成组件。其他一切都应该由标准 Spring <context:mbean-export/> 管理.

关于java - MBean 未显示在 jvisualVM 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37734269/

相关文章:

jmx - 属性和项目的 Prometheus jmx 导出器模式匹配

java - 自定义 MBean HTML 页面

java - 断词规则文件

java - Minecraft [GRADLE] 1.7.2 - 无法使用外部 .jar?

java - Spring Integration 中的 Http Outbound Gateway 错误处理

java - Spring 集成 - 带有 SimpleAsyncTaskExecutor 的任务执行器

java - 用于访问 Liberty 中的数据源连接管理器 MBean 的通用对象名称

java - 如何使用 Restful 调用 Auth 身份验证

java - 通过 ektorp 弹性地使用 java 中的 couchdb

java - Spring 集成: get all headers involved in an aggration and not just the last one