AnsweredAssumed Answered

Question for spring gurus

Question asked by ale_carraro on Jun 18, 2009
Latest reply on Jun 18, 2009 by ale_carraro
Hi to all, I've the following problem. I'm just starting with spring, so please don't blame me if it is a stupid question, since I still don't know if it is Spring or Alfresco related.


I'm trying to use jooreports feature of compiling OpenOffice reports, and I created this bean in config-custom.xml

   <bean id="ooTemplateWriter" parent="baseJavaScriptExtension" class="it.broadwaysolutions.OpenOfficeTemplateWriter">
       <property name="extensionName">
           <value>ooTemplateWriter</value>
       </property>
      <property name="contentService">
         <ref bean="contentService" />
      </property>
      <property name="mimetypeService">
         <ref bean="mimetypeService" />
      </property>
      <property name="connection">
         <ref bean="openOfficeConnection" />
      </property>
      <property name="documentFormatsConfiguration">
         <value>classpath:alfresco/mimetype/openoffice-document-formats.xml</value>
      </property>
   </bean>

But starting it says that
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ooTemplateWriter' defined in file [C:\Alfresco31\tomcat\shared\classes\alfresco\extension\custom-model-context.xml]: Cannot resolve reference to bean 'openOfficeConnection' while setting bean property 'connection'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'openOfficeConnection' is defined


Looking at the logs, the first idea that came into my mind is the order used by spring to load beans, that is my bean is going to be instantiated before openOfficeConnection.

This idea came into my mind because when I start Alfresco without my bean, instantiation of openOffice seem to come very late (during third-party subsystem).

Is there a way to force my bean initialization to be done after this third-party subsystem bootstrap?

I'm using Alfresco 3.2 because I need a feature present in 3.1, but also a bug-fix in 3.2 that corrected a bug born in 3.1 (FTL templates do not like multi value properties…)

thanks

Alex

Outcomes