Improve documentation for FactoryBean's getObject automatic call through @ManagedResource [SPR-17139] #21676
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: documentation
A documentation task
Milestone
Manuel Jordan opened SPR-17139 and commented
I have the following situation about
FactoryBean
for thegetObject()
execution.I have for example:
Where:
From above:
@Bean
method is created/managed by Spring@Bean
method that works with@Conditional
I can call and execute manually thegetObject()
method.Until here all work how is expected.
My problem is with
RabbitMQ
, I have the following:and
Thus the following:
@Bean
method is created/managed by Spring@Bean
method that works with@Conditional
I can call and execute manually thegetObject()
method.When
@Conditional
is false that other@Bean
never calls and execute manually thegetObject()
method. It is expected.Problem: but because
implements FactoryBean<ActiveMQConnectionFactory>
works withActiveMQConnectionFactory
and it is declared how:I did realise that because the component is marked with
@ManagedResource
, Spring through JMX, calls automatically thegetObject()
method. Arising errors.I have the following:
If I comment
@EnableMBeanExport
the app starts up without problem. But I need use JMX for other components, I need Spring does not execute automatically that@ManagedResource
.This behaviour about JMX triggers automatically the
getObject()
method when theFactoryBean
's type is marked with@ManagedResource
(i.e:CachingConnectionFactory
) is not covered neither 1.8.3. Customizing instantiation logic with a FactoryBean nor 4. JMXAffects: 5.0.8
The text was updated successfully, but these errors were encountered: