I have more than 5 spring web application and all of them are utilizing another common library. This common library has its own MBeans. Because of mandatory unique objectName constraint, my applications could not be deployed on same server.
The way I am using MBeans are like this:
@ManagedResource(objectName = "com.org.city:name=City", description = "City related operations")
I would like to use same MBean class with different objectNames for all applications. What is the correct way to utilize it without duplicating my MBeans.
Thanks
I have implemented ObjectNamingStrategy for custom behaviour.
@Override
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
Class managedClass = AopUtils.getTargetClass(managedBean);
Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put("type",ClassUtils.getPackageName(managedClass).concat(".").concat(ClassUtils.getShortName(managedClass)));
properties.put("name", beanKey);
return ObjectNameManager.getInstance(domain, properties);
}