@@ -183,18 +183,21 @@ as the following example shows:
183
183
184
184
If you configure a bean with an `MBeanExporter` that is also configured for lazy
185
185
initialization, the `MBeanExporter` does not break this contract and avoids
186
- instantiating the bean. Instead, it registers a proxy with the `MBeanServer` and
187
- defers obtaining the bean from the container until the first invocation on the proxy
188
- occurs.
186
+ instantiating the bean. Instead, it registers a proxy with the `MBeanServer` and defers
187
+ obtaining the bean from the container until the first invocation on the proxy occurs.
188
+
189
+ This also affects `FactoryBean` resolution where `MBeanExporter` will regularly
190
+ introspect the produced object, effectively triggering `FactoryBean.getObject()`.
191
+ In order to avoid this, mark the corresponding bean definition as lazy-init.
189
192
190
193
191
194
[[jmx-exporting-auto]]
192
195
== Automatic Registration of MBeans
193
196
194
- Any beans that are exported through the `MBeanExporter` and are already valid MBeans are
195
- registered as-is with the `MBeanServer` without further intervention from Spring. You can cause MBeans
196
- to be automatically detected by the `MBeanExporter` by setting the `autodetect`
197
- property to `true`, as the following example shows:
197
+ Any beans that are exported through the `MBeanExporter` and are already valid MBeans
198
+ are registered as-is with the `MBeanServer` without further intervention from Spring.
199
+ You can cause MBeans to be automatically detected by the `MBeanExporter` by setting
200
+ the `autodetect` property to `true`, as the following example shows:
198
201
199
202
[source,xml,indent=0,subs="verbatim,quotes"]
200
203
----
0 commit comments