-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
spring.xml
80 lines (69 loc) · 3.15 KB
/
spring.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- test spring config file that shows off the support for the Spring Framework (an optional dependency) -->
<!-- publishes classes that have @JmxResource or implement JmxSelfNaming to jmxServer automagically -->
<bean id="beanPublisher" class="com.j256.simplejmx.spring.BeanPublisher">
<property name="jmxServer" ref="jmxServer" />
</bean>
<!-- JMX server which publishes our beans via JMX -->
<bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer" init-method="start" destroy-method="stop">
<!-- the port should probably come from a configured property -->
<property name="registryPort" value="8000" />
</bean>
<!-- -->
<!-- bean for monitoring and shutting down our main application -->
<bean id="mainJmx" class="com.j256.simplejmx.spring.MainJmx" />
<!-- a random bean exposing stuff through JMX -->
<bean id="runtimeCounter" class="com.j256.simplejmx.example.BasicExample$RuntimeCounter" />
<!-- a bean that registers/unregisters other beans dynamically by calling to the JMX server -->
<bean id="dynamicJmx" class="com.j256.simplejmx.spring.DynamicJmx">
<!-- we need this to register/unregister dynamic objects -->
<property name="jmxServer" ref="jmxServer" />
</bean>
<!-- demonstration of expose information from another bean (in this case our jmxserver) without annotations -->
<bean id="jmxServerJmx" class="com.j256.simplejmx.spring.JmxBean">
<property name="jmxResourceInfo">
<bean class="com.j256.simplejmx.common.JmxResourceInfo">
<property name="jmxDomainName" value="j256.simplejmx" />
<property name="jmxBeanName" value="JmxServer" />
</bean>
</property>
<property name="attributeFieldInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxAttributeFieldInfo">
<property name="name" value="serverPort" />
</bean>
</array>
</property>
<property name="attributeMethodInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxAttributeMethodInfo">
<property name="methodName" value="getRegisteredCount" />
</bean>
</array>
</property>
<property name="operationInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxOperationInfo">
<property name="methodName" value="stop" />
</bean>
</array>
</property>
<property name="target" ref="jmxServer" />
</bean>
<!-- create some object, in this case a String -->
<bean id="someObject" class="java.lang.String">
<constructor-arg value="String value" type="java.lang.String" />
</bean>
<!-- publish all of the public fields and methods about it -->
<bean id="someObjectPublished" class="com.j256.simplejmx.server.PublishAllBeanWrapper">
<property name="delegate" ref="someObject" />
<property name="jmxResourceInfo">
<bean class="com.j256.simplejmx.common.JmxResourceInfo">
<property name="jmxDomainName" value="j256.simplejmx" />
<property name="jmxBeanName" value="SomeObject" />
</bean>
</property>
</bean>
</beans>