Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7160775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:27:14+00:00 2026-05-28T13:27:14+00:00

I used org.springframework.jmx.export.annotation.@ManagedOperation to expose a method as MBean. I want the operation name

  • 0

I used org.springframework.jmx.export.annotation.@ManagedOperation to expose a method as MBean.

I want the operation name different from the method name, but managed operation doesn’t have any attribute for it.

For example:

@ManagedOperation
public synchronized void clearCache() 
{
   // do something
}

and I want this operation exposed with name = “ResetCache”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:27:15+00:00Added an answer on May 28, 2026 at 1:27 pm

    Create a custom annotation:

    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.METHOD)
    public @interface JmxName {
        String value();
    }
    

    And a custom subclass of MetadataMBeanInfoAssembler:

    public class CustomMetadataMBeanInfoAssembler extends MetadataMBeanInfoAssembler {
    
        private String getName(final Method method) {
            final JmxName annotation = method.getAnnotation(JmxName.class);
            if (annotation != null) {
                return annotation.value();
            }else
                return method.getName();
            }
        }
        protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
                return new ModelMBeanOperationInfo(getName(method),
                    getOperationDescription(method, beanKey),
                    getOperationParameters(method, beanKey),
                    method.getReturnType().getName(),
                    MBeanOperationInfo.UNKNOWN);
        }
    
    }
    

    and you should get it to work if you wire the CustomMetadataMBeanInfoAssembler (and use the annotation):

    <bean id="jmxAttributeSource"
          class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>
    
    <!-- will create management interface using annotation metadata -->
    <bean id="assembler"
          class="com.yourcompany.some.path.CustomMetadataMBeanInfoAssembler">
        <property name="attributeSource" ref="jmxAttributeSource"/>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the python keyword with used for? Example from: http://docs.python.org/tutorial/inputoutput.html >>> with open('/tmp/workfile',
I have a controller that inherits from the org.springframework.web.servlet.mvc.AbstractController class I have configurated it
I tried to see if I could use org.springframework.web.bind.annotation.ExceptionHandler in a Repository out of
<bean id=xyz class=com.abc > <property name=name> <bean class=org.springframework.beans.factory.config.FieldRetrievingFactoryBean> <property name=staticField value=com.abc.staticname /> </bean> </property>
I used the same software used here http://us.gn.bartal.org/ to create a fixed width/height treemap
Here is the code currently used. public String getStringFromDoc(org.w3c.dom.Document doc) { try { DOMSource
i have a DTD file which i used to accessed through this link: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
I am mostly following this page: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html I used this command to create the
Never used a cache like this before. The problem is that I want to
<context:annotation-config/> <context:component-scan... this is used for class that i need to annotated with @Repository

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.