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

ManagedResource Annotation is not annoted as Inherited [SPR-3500] #8183

Closed
spring-projects-issues opened this issue May 19, 2007 · 4 comments
Closed
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented May 19, 2007

Ray Krueger opened SPR-3500 and commented

I was attempting to annotate an Abstract class as @ManagedResource so that all the subclasses could be auto-discovered. Unfortunately the @ManagedResource annotation itself is not annotated as @Inherited.


Affects: 2.0.1

Referenced from: commits 95a7ec6

1 votes, 2 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 19, 2007

Juergen Hoeller commented

This is by intent, actually: @ManagedResource is specified for a specific MBean (allowing to specify its object name etc), so is only expected on concrete classes. In case of a class hierarchy, it needs to be repeated on every concrete class that's supposed to instantiated as a manageable Spring bean.

FWIW: Similar other annotations aren't inherited either, e.g. JPA's @Entity.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 19, 2007

Ray Krueger commented

Being able combine autodetection with an inheritble MonitoredResource would be pretty powerful.

If there's no chance of me talking you into it go ahead and close this :)

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 20, 2009

Greg Nieman commented

Submitted on behalf of customer:

I would like to understand why Spring's jmx @ManagedResource is not annotated with @Inherited.

I believe this is a very legitimate jmx use-case, especially when combined with SelfNaming interface.

A common use-case we have is:
We have a base class that is a @ManagedResource, and it also implements SelfNaming along with BeanNameAware, so that it names itself properly.
And the subclasses don't need to put @ManagedResource anymore, AND people don't need to remember putting this annotation on every subclass they have extending the base one.

There is a JIRA I found here: http://jira.springframework.org/browse/SPR-3500, but it seems to have been closed.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 8, 2009

Juergen Hoeller commented

We finally changed @ManagedResource to inherited now. Potential object name collisions need to be dealt with; the general recommendation is to not specify an object name value in @ManagedResource at all when using it on a base class.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants