Skip to content
cyrille-leclerc edited this page Jan 14, 2013 · 6 revisions

Declare bean:

<beans ...
       xmlns:jmxtrans="http://www.jmxtrans.org/schema/embedded"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="...
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.jmxtrans.org/schema/embedded http://www.jmxtrans.org/schema/embedded/jmxtrans-1.0.xsd">

    <context:annotation-config/>

    <jmxtrans:jmxtrans>
        <jmxtrans:configuration>classpath:jmxtrans.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/tomcat-6.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/jmxtrans-internals.json</jmxtrans:configuration>
        <jmxtrans:configuration>classpath:org/jmxtrans/embedded/config/jvm-sun-hotspot.json</jmxtrans:configuration>
    </jmxtrans:jmxtrans>
</beans>

NOTE: Don't forget to declare <context:annotation-config/> to handle embedded-jmxtrans' lifecycle annotation @PreDestroy at shutdown.

<jmxtrans:jmxtrans />

  • id: optional id of the Spring bean. Default "jmxtrans"
  • configuration: coma delimited list of urls (classpath:, http://..., file:/...). Default value is classpath:jmxtrans.json, classpath:org/jmxtrans/embedded/config/jmxtrans-internals.json. Optional.
  • ignore-configuration-not-found: Specifies if failure to find the JSON configuration resource location should be ignored. Default is "false", meaning that if there is no file in the configuration specified an exception will be raised at runtime
  • 0..* children elements <jmxtrans:configuration>: urls of json configuration files (classpath:, http://..., file:/...) .