Relaxed assertion in NotificationPublisherAwareLazyTargetSource

Issue: SPR-17592
This commit is contained in:
Juergen Hoeller 2018-12-12 12:16:14 +01:00
parent 7b9c30f26e
commit 2c98c1b81a
1 changed files with 2 additions and 3 deletions

View File

@ -939,9 +939,9 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
* {@link org.springframework.jmx.export.notification.NotificationPublisher} is injected.
*/
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(
new ModelMBeanNotificationPublisher(modelMBean, objectName, managedResource));
}
@ -1112,7 +1112,6 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
@Override
protected void postProcessTargetObject(Object targetObject) {
Assert.state(this.modelMBean != null && this.objectName != null, "Not initialized");
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);
}
}