Showing posts with label JMX. Show all posts
Showing posts with label JMX. Show all posts

Sunday, 1 July 2012

Exposing monitoring by JMX in Spring application

To expose methods as MBeans in the Spring Application by JMX you have to:
  • Declare in the application configuration: <context:mbean-export/>
  • Annotate java class with @ManagedResource
  • Annotate getters or setters with <@ManagedAttribute>
After that you can connect by jconsole to your application and use annotated methods.
You can also use annotations: @ManagedOperation, @ManagedNotification for methods that are not setters or getters.

Thursday, 9 February 2012

Exposing variables by JMX in Spring Applications

If you wish to expose variable by JMX in the Spring application you have to:
  1. Add in the spring context the tag:
    <context:mbean-export/>
  2. On the managed class add annotation @ManagedResource
  3. On this method you want to be exposed add annotation
    • For getters and setters - @ManagedAttribute
    • For all type of operations - @ManagedOperation