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

Issue: SPR-12399
This commit is contained in:
Juergen Hoeller 2014-10-30 21:57:19 +01:00
parent db2601d6e2
commit 5f160c17cd
1 changed files with 13 additions and 0 deletions

View File

@ -1097,6 +1097,19 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
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
protected void postProcessTargetObject(Object targetObject) {
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);