Announcement Announcement Module
No announcement yet.
Annotation based JMX: Defining descriptions of default method argument values Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Annotation based JMX: Defining descriptions of default method argument values


    I've seen the following example:

    package org.springframework.jmx;
    import org.springframework.jmx.export.annotation.ManagedResource;
    import org.springframework.jmx.export.annotation.ManagedOperation;
    import org.springframework.jmx.export.annotation.ManagedAttribute;
    @ManagedResource(objectName="bean:name=testBean4", description="My Managed Bean", log=true,
        logFile="jmx.log", currencyTimeLimit=15, persistPolicy="OnUpdate", persistPeriod=200,
        persistLocation="foo", persistName="bar")
    public class AnnotationTestBean implements IJmxTestBean {
      private String name;
      private int age;
      @ManagedAttribute(description="The Age Attribute", currencyTimeLimit=15)
      public int getAge() {
        return age;
      public void setAge(int age) {
        this.age = age;
      @ManagedAttribute(description="The Name Attribute",
      public void setName(String name) { = name;
      @ManagedAttribute(defaultValue="foo", persistPeriod=300)
      public String getName() {
        return name;
      @ManagedOperation(description="Add two numbers")
        @ManagedOperationParameter(name = "x", description = "The first number"),
        @ManagedOperationParameter(name = "y", description = "The second number")})
      public int add(int x, int y) {
        return x + y;
      public void dontExposeMe() {
        throw new RuntimeException();

    and that works fine.

    However is there any way to populate the method argument fields in jconsole with default values? So instead of the field saying 'String' by default it will say 'Name'.

    I think I've seen this in jconsole before but I would like to know how to do this using Spring. Or is this not possible at all?

    Many thanks.

    UPDATE: Never mind. It seems I was thinking of something else. The above already achieves what I am asking for. Sorry!
    Last edited by Narada; Mar 8th, 2008, 07:40 PM.