How would you implement Spring like annotation based JMX feature. If class is marked by @ManagedResource
methods of the class marked with @ManagedOperation
are automatically exposed via JMX.
I would like to avoid creating interfaces with MBean notation. I'm using Play with Guice framework. The naive approach first comes to mind:
- Iterate over all classes managed by Guice
- If class is marked with annotation, create new interface which fits MBean notation. Amend class, amended class should implement new created interface.
- Register instance of the class in MBean server.
Second step will be done using byte code manipulation tool, for example ASM. Is it possible to do it with ASM ? How would you implement such feature ?