I'm using Camel 2.5 and trying to register my own MBean. After struggling a bit to figure out how (the docs seem outdated on this and the book wasn't very helpful about it). I came up with an MBean class that looks like:
@ManagedResource(objectName = "MyMBean") public class MyMBean implements Service, ManagementAware<MyMBean> { ..... @NotNull @Override public Object getManagedObject(@NotNull MyMBean aMBean) { LOGGER.warn("Mananaging {}", aMBean); return this; } } Even though this MBean is used in a created by Spring and used in a camel route it does not show up in the jmx section correctly until I also add: try { final ManagementStrategy myManagementStrategy = getContext().getManagementStrategy(); final ManagementNamingStrategy myManagementNamingStrategy = myManagementStrategy.getManagementNamingStrategy(); myManagementStrategy.manageNamedObject(theMBean, myManagementNamingStrategy.getObjectNameForService(getContext(), theMBean)); } catch (Exception myException) { throw new IllegalStateException(myException); } Is there a way to avoid this? I know Camel 2.6 says that MBeans only need to be annotated to be registered but this is in Camel 2.5