MBeanExporter logs lazy bean retrieval exceptions on the server at warn level

Issue: SPR-12399
master
Juergen Hoeller 10 years ago
parent db2601d6e2
commit 5f160c17cd
  1. 13
      spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java

@ -1097,6 +1097,19 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
this.objectName = objectName; this.objectName = objectName;
} }
@Override
public Object getTarget() {
try {
return super.getTarget();
}
catch (RuntimeException ex) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to retrieve target for JMX-exposed bean [" + this.objectName + "]: " + ex);
}
throw ex;
}
}
@Override @Override
protected void postProcessTargetObject(Object targetObject) { protected void postProcessTargetObject(Object targetObject) {
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName); injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);

Loading…
Cancel
Save