本文整理汇总了Java中org.springframework.jmx.export.MBeanExporter.setBeans方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanExporter.setBeans方法的具体用法?Java MBeanExporter.setBeans怎么用?Java MBeanExporter.setBeans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jmx.export.MBeanExporter
的用法示例。
在下文中一共展示了MBeanExporter.setBeans方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSetUp
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Override
public void onSetUp() throws Exception {
target = new JmxTestBean();
target.setAge(100);
target.setName("Rob Harrop");
MBeanExporter adapter = new MBeanExporter();
Map<String, Object> beans = new HashMap<String, Object>();
beans.put(OBJECT_NAME, target);
adapter.setServer(getServer());
adapter.setBeans(beans);
adapter.setAssembler(new ProxyTestAssembler());
start(adapter);
}
示例2: testWithCglibProxy
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Test
public void testWithCglibProxy() throws Exception {
IJmxTestBean tb = createJmxTestBean();
ProxyFactory pf = new ProxyFactory();
pf.setTarget(tb);
pf.addAdvice(new NopInterceptor());
Object proxy = pf.getProxy();
MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler();
MBeanExporter exporter = new MBeanExporter();
exporter.setBeanFactory(getContext());
exporter.setAssembler(assembler);
String objectName = "spring:bean=test,proxy=true";
Map<String, Object> beans = new HashMap<String, Object>();
beans.put(objectName, proxy);
exporter.setBeans(beans);
start(exporter);
MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName));
assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length);
assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length);
assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name"));
}
示例3: jmxService
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Bean
@DependsOn("statisticsService")
public MBeanExporter jmxService(Statistics statistics) {
MBeanExporter exporter = new MBeanExporter();
exporter.setBeans(ImmutableMap.of("Hibernate:application=Statistics", (Object) statistics));
return exporter;
}
示例4: onSetUp
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Override
public void onSetUp() throws Exception {
target = new JmxTestBean();
target.setAge(100);
target.setName("Rob Harrop");
MBeanExporter adapter = new MBeanExporter();
Map<String, Object> beans = new HashMap<String, Object>();
beans.put(OBJECT_NAME, target);
adapter.setServer(getServer());
adapter.setBeans(beans);
adapter.setAssembler(new ProxyTestAssembler());
adapter.afterPropertiesSet();
}
示例5: testWithCglibProxy
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Test
public void testWithCglibProxy() throws Exception {
IJmxTestBean tb = createJmxTestBean();
ProxyFactory pf = new ProxyFactory();
pf.setTarget(tb);
pf.addAdvice(new NopInterceptor());
Object proxy = pf.getProxy();
MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler();
MBeanExporter exporter = new MBeanExporter();
exporter.setBeanFactory(getContext());
exporter.setAssembler(assembler);
String objectName = "spring:bean=test,proxy=true";
Map<String, Object> beans = new HashMap<String, Object>();
beans.put(objectName, proxy);
exporter.setBeans(beans);
exporter.afterPropertiesSet();
MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName));
assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length);
assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length);
assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name"));
}
示例6: mBeanExporter
import org.springframework.jmx.export.MBeanExporter; //导入方法依赖的package包/类
@Bean
public MBeanExporter mBeanExporter(JobOperator jobOperator) {
Map<String, Object> map = new HashMap<>();
map.put("kr.spring.batch:name=jobOperator", jobOperator);
MBeanExporter exporter = new MBeanExporter();
exporter.setBeans(map);
return exporter;
}