views:

78

answers:

0

I have a Spring bean that is exposed via JMX using Spring annotations, but the parameter names remain blank and the operation and parameter descriptions don't show up. Can this be fixed without resorting to tedious XML definition files?

I implemented this closely following a blog post. Here's my simplified code:

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(objectName="group:name=foo", description="Does a lot of fooing")
public class Foo {
    @ManagedOperation(description="Changes the period of the given task and applies it immediately if the task is enabled.")
    @ManagedOperationParameters({
        @ManagedOperationParameter(name="index", description="the 0-based index of the fizzle"),
        @ManagedOperationParameter(name="baz", description="the baz value to set on the fizzle")
    })
    public void changeFizzle(int index, long baz) {
        // impl
    }
}

The relevant spring application context definition is copied verbatim from the blog post linked above.