The main problem that I have here is that I have one XML file that is used as a utility file and imported into other xml files. It defines a series of objects to connect to the platform and provides an interface for it. The beans in this file are defined as lazy-initialized, so if you don’t want to connect to the platform, you won’t, but if you start referencing the corresponding bean, then everything should get up and running.
The main problem I am facing is that one of the beans in this set is not an explanation of any of the others, but it needs to be constructed in such a way that it will call a method on one of the other beans in order to " activate "it. (He acts as a gatekeeper by turning on / off the connection based on what he defines as the state of the platform).
Here is the dummy view of the XML configuration that I have:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"
default-lazy-init="true">
<bean id="PlatformConnection">
<constructor-arg ref="PlatformConnectionProperties" />
</bean>
<bean id="PlatformConnectionProperties"/>
<bean lazy-init="false" class="PlatformStatusNotifier">
<constructor-arg ref="PlatformConnection" />
<constructor-arg ref="PlatformConnectionDataBus" />
</bean>
<bean id="PlatformConnectionDataBus" class="DataBus"/>
<bean lazy-init="false" class="DataBusConnector">
<constructor-arg>
<bean class="PlatformSpecificDataBusObjectSender">
<constructor-arg ref="PlatformConnection" />
</bean>
</constructor-arg>
<constructor-arg ref="PlatformConnectionDataBus" />
</bean>
</beans>
Now basically I want to remove the lazy elements here that are necessary for this thing to work properly. The objects referenced by client XML are PlatformConnectionand PlatformConnectionDataBus. How can I explain that I want these other beans to be created if they are referenced?