What is the best way to access the Spring application context in a Java backed web script? I want to use it to load a classpath resource (an XSL file). I have tried ApplicationContextHelper.getApplicationContext(), which tries to load the application context where the web script in question is declared, but gets an error:20:53:38,217 User:admin ERROR [scripts.export.OrderPrint] Could not create a print order
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'webscript.com.cadq.alfresco.common.repository.export.stream-temp-file' defined in file [C:\Users\nils.weinander\Program\Alfresco-3.1\tomcat\shared\classes\alfresco\extension\cadq-projektnavet-alfresco-context.xml]: Could not resolve parent bean definition 'webscript'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'webscript' is defined
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'webscript' is defined
cadq-projektnavet-alfresco-context.xml refers to webscript: <bean id="webscript.com.cadq.alfresco.common.repository.export.stream-temp-file"
class="com.cadq.alfresco.common.repo.web.scripts.export.StreamTemporaryFile"
parent="webscript">
<property name="contentService" ref="ContentService" />
<property name="mimetypeService" ref="MimetypeService" />
<property name="nodeService" ref="NodeService" />
<property name="permissionService" ref="PermissionService" />
</bean>
is the first bean in it.I have managed to get an application context bynew ClassPathXmlApplicationContext("alfresco/webscript-framework-application-context.xml")but creating a new instance doesn't seem right. Is there a way to get a ready instance of a "base" application context from a Java backed web script?