@@ -197,7 +197,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
197
197
* Bean instances are typically linked in through bean references.
198
198
* Bean names will be resolved as beans in the current factory, respecting
199
199
* lazy-init markers (that is, not triggering initialization of such beans).
200
- * @param beans Map with JMX names as keys and bean instances or bean names
200
+ * @param beans a Map with JMX names as keys and bean instances or bean names
201
201
* as values
202
202
* @see #setNamingStrategy
203
203
* @see org.springframework.jmx.export.naming.KeyNamingStrategy
@@ -509,7 +509,7 @@ public void unregisterManagedResource(ObjectName objectName) {
509
509
/**
510
510
* Register the defined beans with the {@link MBeanServer}.
511
511
* <p>Each bean is exposed to the {@code MBeanServer} via a
512
- * {@code ModelMBean}. The actual implemetation of the
512
+ * {@code ModelMBean}. The actual implementation of the
513
513
* {@code ModelMBean} interface used depends on the implementation of
514
514
* the {@code ModelMBeanProvider} interface that is configured. By
515
515
* default the {@code RequiredModelMBean} class that is supplied with
@@ -939,9 +939,9 @@ private boolean isBeanDefinitionAbstract(ListableBeanFactory beanFactory, String
939
939
* {@link org.springframework.jmx.export.notification.NotificationPublisher} is injected.
940
940
*/
941
941
private void injectNotificationPublisherIfNecessary (
942
- Object managedResource , ModelMBean modelMBean , ObjectName objectName ) {
942
+ Object managedResource , @ Nullable ModelMBean modelMBean , @ Nullable ObjectName objectName ) {
943
943
944
- if (managedResource instanceof NotificationPublisherAware ) {
944
+ if (managedResource instanceof NotificationPublisherAware && modelMBean != null && objectName != null ) {
945
945
((NotificationPublisherAware ) managedResource ).setNotificationPublisher (
946
946
new ModelMBeanNotificationPublisher (modelMBean , objectName , managedResource ));
947
947
}
@@ -1029,7 +1029,7 @@ protected void onUnregister(ObjectName objectName) {
1029
1029
}
1030
1030
1031
1031
1032
- /**
1032
+ /**
1033
1033
* Notifies all registered {@link MBeanExporterListener MBeanExporterListeners} of the
1034
1034
* registration of the MBean identified by the supplied {@link ObjectName}.
1035
1035
*/
@@ -1112,7 +1112,6 @@ public Object getTarget() {
1112
1112
1113
1113
@ Override
1114
1114
protected void postProcessTargetObject (Object targetObject ) {
1115
- Assert .state (this .modelMBean != null && this .objectName != null , "Not initialized" );
1116
1115
injectNotificationPublisherIfNecessary (targetObject , this .modelMBean , this .objectName );
1117
1116
}
1118
1117
}
0 commit comments