In spring ManagedOperation annotation is used to export spring methods into jconsole. We also can pass the arguments into JMX exposed methods.ManagedOperation syntax is like below.


package com;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;
import org.springframework.jmx.export.annotation.ManagedOperationParameters;
import org.springframework.jmx.export.annotation.ManagedResource;

@ManagedResource
public class SpringJMXExample {

@ManagedOperation(description = "Description about method")
  @ManagedOperationParameters({
    @ManagedOperationParameter(description = "Enter the name", name = "Name")
    })
  public String getName(String name){
 return "Your name is"+
  }

}

This can be accessed through jconsole and This class has two attributes one called attributes and another one operations. Under operation we can see the method name getName with arguments.