Relaxed assertion in NotificationPublisherAwareLazyTargetSource
Issue: SPR-17592
This commit is contained in:
parent
7b9c30f26e
commit
2c98c1b81a
|
@ -939,9 +939,9 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||||
* {@link org.springframework.jmx.export.notification.NotificationPublisher} is injected.
|
* {@link org.springframework.jmx.export.notification.NotificationPublisher} is injected.
|
||||||
*/
|
*/
|
||||||
private void injectNotificationPublisherIfNecessary(
|
private void injectNotificationPublisherIfNecessary(
|
||||||
Object managedResource, ModelMBean modelMBean, ObjectName objectName) {
|
Object managedResource, @Nullable ModelMBean modelMBean, @Nullable ObjectName objectName) {
|
||||||
|
|
||||||
if (managedResource instanceof NotificationPublisherAware) {
|
if (managedResource instanceof NotificationPublisherAware && modelMBean != null && objectName != null) {
|
||||||
((NotificationPublisherAware) managedResource).setNotificationPublisher(
|
((NotificationPublisherAware) managedResource).setNotificationPublisher(
|
||||||
new ModelMBeanNotificationPublisher(modelMBean, objectName, managedResource));
|
new ModelMBeanNotificationPublisher(modelMBean, objectName, managedResource));
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1112,6 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void postProcessTargetObject(Object targetObject) {
|
protected void postProcessTargetObject(Object targetObject) {
|
||||||
Assert.state(this.modelMBean != null && this.objectName != null, "Not initialized");
|
|
||||||
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);
|
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue