AnsweredAssumed Answered

Unable to load classpath*:alfresco/extension/*-context.xml

Question asked by diegop on Oct 13, 2010
Latest reply on Oct 13, 2010 by diegop
I am starting a new project using Alfresco 3.4a (I used Alfresco 2.1 CE for last 2 years…)

So, I am trying to develope a new custom model.

I wrote my-content-model-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!– Registration of new models –>   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/myContentModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/extension/messages/my-content</value>
            </list>
        </property>       
    </bean>
         
</beans>

and I put my-content-model-context.xml in <TOMCAT_HOME>\shared\classes\alfresco\extension but it doesn't work.

I read this page: http://wiki.alfresco.com/wiki/Overriding_Spring_Configuration
so i renamed my-content-model-context.xml in dev-context.xml and it works.

It all so strange…because I found this in <TOMCAT_HOME>\webapps\alfresco\WEB-INF\classes\alfresco\application-context.xml:
    
….
    <import resource="classpath*:alfresco/extension/*-context.xml"/>          <— attention for this row!!!!!
    <import resource="classpath*:alfresco/deprecated-context.xml"/>
    <import resource="classpath*:alfresco/extension/dev-context.xml" />



So I suppose that my original file <TOMCAT_HOME>\shared\classes\alfresco\extension\my-content-model-context.xml should be read at Alfresco startup….but it is not so!

So, is there some problem? Did i make some mistake?

I don't like to use one only "anomyous" dev-context.xml file to write all my custom Spring beans, for now i found this workaround: import file my-content-model-context.xml from dev-context.xml.

so this is my final dev-context.xml (for now):

<beans>

    <import resource="classpath*:alfresco/extension/my-content-model-context.xml" />

</beans>

but I think that it should be automatic lo load each *-context.xml file in extension folder…but it is not so!

thanks in advance

Outcomes