Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce @EnableMBeanExport equivalent to <context:mbean-export> [SPR-8943] #13583

Closed
spring-issuemaster opened this issue Dec 18, 2011 · 5 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Dec 18, 2011

Tomasz Nurkiewicz opened SPR-8943 and commented

Spring 3.1 introduces several @Enable* annotations. However this code snippet:

<context:mbean-export/>

cannot be expressed with annotations. There is a valid simple workaround:

@Bean
public AnnotationMBeanExporter annotationMBeanExporter() {
    return new AnnotationMBeanExporter();
}

but it would be nice to have built-in @Enable... annotation. Note that in JavaConfig project there was @MBeanExport annotation.


Affects: 3.1 GA

Sub-tasks:

  • #14552 Document @EnableMBeanExport in reference manual

Issue Links:

  • #12963 Provide @Configuration support for automatic MBean registration ("is duplicated by")
  • #17728 Add an enum for MBeanExporter Autodetect Mode

Referenced from: commits 0bd4dab, d52e868, 5d4d1ea, cae08db

5 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 22, 2012

Bob Tiernay commented

I agree. @EnableMBeanExport seams to be missing from the list of @Enable* annotations. In order to fully support this, @ManagedResource should be relaxed to allow for putting this on a method in @Configuration classes. Otherwise it is not possible to expose a bean via annotations for which you do not have the source for.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 22, 2012

Phil Webb commented

Bob Tiernay I have created #14541 for allowing @ManagedResource to be used on @Bean methods. Please track that issue if you want to monitor progress. This issue will only target @EnableMBeanExport functionality.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 22, 2012

Phil Webb commented

#171

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 25, 2012

Chris Beams commented

Thanks, Phil!

commit cae08db6a9808bf9708d8bfd69417f792d4b06b6
Author: Phillip Webb <pwebb@vmware.com>
Commit: Chris Beams <cbeams@vmware.com>

    Introduce @EnableMBeanExport
    
    Add support for @EnableMBeanExport annotation allowing @Configuration
    classes to easily export all MBeans and @ManagedResources from the
    Spring application context. The annotation is functionally equivalent
    to the XML <context:mbean-export/> element.
    
    Issue: SPR-8943
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 26, 2012

Chris Beams commented

commit 5d4d1eaca4fa8af29f07e23b89bee8fd028820bd
Author: Chris Beams <cbeams@vmware.com>
Commit: Chris Beams <cbeams@vmware.com>

    Fix package cycle in @EnableMBeanExport
    
    Prior to this commit, @EnableMBeanExport was declared in the
    jmx.export.annotation package. This makes logical sense, but
    nevertheless creates a package cycle, because @EnableMBeanExport depends
    on MBeanExportConfiguration which in turn depends on context.annotation
    types like @Configuration, @Bean, and @Role.
    
    context.annotation.config.MBeanExportBeanDefinitionParser, on the other
    hand already has dependencies on types in jmx.support. Together, this
    means that a package cycle was introduced.
    
    The solution to this is simple: move @EnableMBeanExport and friends from
    jmx.export.annotation => context.annotation. This has been the strategy
    for other @Enable annotations and for the same reasons. It also makes a
    kind of logical sense: just like you find <context:mbean-export> and
    <context:load-time-weaver> under the context: XML namespace, so too do
    you find their @Enable* counterparts under the context.annotation
    namespace.
    
    Issue: SPR-8943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.