Hi,
I'm looking for a solution to create every services from processEngine directly via spring factory feature but Spring complain about circular references !
My current configuration :
<bean id="springHelper">
<property name="jbpmCfg" value="jbpm.cfg.xml" />
</bean>
<bean id="processEngine" factory-bean="springHelper"
factory-method="createProcessEngine" scope="singleton" depends-on="springHelper" />
<bean id="repositoryService" factory-bean="processEngine"
factory-method="getRepositoryService" scope="singleton"
depends-on="springHelper,processEngine" />
I've got an Exception using that config :
org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.jbpm.api.RepositoryService mypackage.myBean.repositoryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositoryService' defined in class path resource [cfg/jbpmConfigurationTest.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.jbpm.api.RepositoryService org.jbpm.pvm.internal.processengine.ProcessEngineImpl.getRepositoryService()] threw exception; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'repositoryService': Requested bean is currently in creation: Is there an unresolvable circular reference?
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
...
Is there any trick to force Spring to initiate the first factory then the processEngine, then the repositoryService and after all resolving autowired fields ?