Help with alfresco and spring beans

cancel
Showing results for 
Search instead for 
Did you mean: 
kefreng
Active Member

Help with alfresco and spring beans

Hi everyone, i'm working with alfresco and i'm making a web page using alfresco , java and spring.

But, my problem now is, i'm trying to call an specific bean from a javascript file and the console show me that my bean is not defined.

For example, 

file.post.js

var result = null;

result = TestFiltroImpl.getAllInformes();

module-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>

<bean id="TestFiltroImpl" parent="baseJavaScriptExtension"
class="cl.alemana.dataImpl.TestFiltroImpl">
<property name="extensionName">
<value>TestFiltroImpl</value>
</property>
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>
</beans>

TestFiltroImpl.java

package cl.alemana.dataImpl;

import java.util.List;

import org.alfresco.repo.processor.BaseProcessorExtension;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.namespace.NamespaceService;

import cl.alemana.data.Filtro;
import cl.alemana.data.TestFiltro;


public class TestFiltroImpl extends BaseProcessorExtension{
private ServiceRegistry serviceRegistry;
private NamespaceService namespaceService;

public ServiceRegistry getServiceRegistry() {
return serviceRegistry;
}

public void setServiceRegistry(ServiceRegistry serviceRegistry) {
this.serviceRegistry = serviceRegistry;
}

public List<Filtro> getAllInformes() throws Exception{
TestFiltro tf = new TestFiltro();
return tf.getAllInformes();
}
}

so, maybe exist an specific file.xml where i need declare my beans (and i don't know because i'm new using alfresco) , 

or i need save my module-context.xml file in a specific path in alfresco.

Please help.

Regards!

1 Reply
douglascrp
Advanced II

Re: Help with alfresco and spring beans

It seems your bean declaration is right.

How are you deploying your -context.xml file, and where exactly?

Post more information here in order for us to try to help you.