I am using a bean factory to load a basic RmiServiceExporter example which I want to be eagerly instantiated as soon as I create my XmlBeanFactory object. I am setting lazy-init to be false and my bean is a singleton scope so according to the docs it should be eagerly instantiated. This is not the case however and the RMI server is not started until I get a reference to the bean by calling factory.getBean(...). Can anyone tell me what I am missing in order to get this bean to eagerly instantiate and launch the RMI server as soon as the factory is created?? Does the creation of the factory not cause the bean definitions file to be parsed? Is the parsing defered until the first getBean method invocation?
XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("beanDefinitions.xml"));
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans default-lazy-init="false"> <bean id="calculationService" class="CalculationServiceImpl" /> <bean id="calculationServiceExporter" class="org.springframework.remoting.rmi.RmiServiceExporter" scope="singleton" lazy-init="false"> <property name="serviceName" value="CalculationService" /> <property name="service" ref="calculationService" /> <property name="serviceInterface" value="CalculationService" /> <property name="registryPort" value="1199" /> </bean> </beans>