AnsweredAssumed Answered

Access Custom Java Spring Bean from Javascript

Question asked by twizzel on Mar 20, 2012
Latest reply on Aug 31, 2012 by monicargrp
Hey,

This is a bit of a weird question, so please bear with me.

Ok, I have a custom Java class (Spring Bean) that contains some code to do some stuff. What I am trying to do is add this Spring Bean to Alfresco and allow other developers to access methods this Spring Bean contains using Javasrcipt.

My question is how do I do this? I'm told it is possible using Alfresco config files but documentation seems to be lacking in this particular area.

What I have done so far is pretty much follow the steps in this little guide : http://wiki.alfresco.com/wiki/Overriding_Spring_Configuration

I have packaged my code into a lovely little Jar file and placed it in the following folder in Alfresco : Alfresco\tomcat\webapps\alfresco\WEB-INF\lib

I then added the following file to Alfresco : Alfresco\tomcat\shared\classes\alfresco\extension\dev-context.xml

It's contents are as follows :

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

<beans>

    <bean id="myServiceBean" class="com.company.service.MyService"></bean>

</beans>
Finally I restarted the Alfresco server.

Is this all I need do to make my Spring Bean acessable via Javascript?


T

Outcomes