-
15. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
cullendw May 10, 2010 2:59 PM (in response to cullendw)Hi Susana,
I would recommend getting hold of the source code for the interceptor and debug through the logic. That is the best way to get an idea of what happening under the hood.
-
16. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
sahra May 11, 2010 2:57 AM (in response to cullendw)Marius,
As you point out I'm not using EJB, but I will try later the sugesstion from Daniel. I just want to point out that as Daniel say the configuration of the deplopyer and spring beans with snowdrop has been very straight forward until I get to the @spring annotation.
Thanks everyone for the help.
Susana
-
17. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
vlad_pax May 12, 2010 1:46 PM (in response to marius.bogoevici)Hi Marius:
My EJB:
package mx.com.tattvait.cyf.facade.impl;
.....
...
@Stateless
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class DummyFacadeBean implements DummyFacadeLocal {@Autowire
private DummyService servicio;
...}
My Service (Spring bean):
package mx.com.tattvait.cyf.service.modulo.impl;
...
..
@Service
public class DummyServiceImpl implements DummyService { .. }applicationContext-service.xml File:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd"><!--context:component-scan base-package="mx.com.tattvait.cyf.service">
<context:include-filter type="regex" expression="mx.com.tattvait.cyf.service.modulo.impl.*" />
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Service" />
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Component" />
</context:component-scan-->
<bean id="DummyService"
class="mx.com.tattvait.cyf.service.modulo.impl.DummyServiceImpl">
</bean>
</beans>beanRefContext.xml File:
<bean id="context"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>applicationContext-service.xml</value>
</list>
</constructor-arg>
</bean>Thanks in advance.
-
18. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
cullendw May 12, 2010 3:19 PM (in response to vlad_pax)I am not too familiar with the SpringBeanAutowiringInterceptor, but I assume you have read http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.html.
Since since you are using Spring 2.5, try using @Qualifier so you would have the following configuration :
@Autowire
@Qualifier("servicio")
private DummyService servicio
and in your application context ...
<bean id="servicio" class="mx.com.tattvait.cyf.service.modulo.impl.DummyServiceImpl"/>
also, you may need to enable :
<context:annotation-config/>
have a look at : http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-autowired-annotation-qualifiers
-
19. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
vlad_pax May 13, 2010 1:03 AM (in response to cullendw)Hi Daniel, thank ypu for you comment.
I did the test with what you tell me but the problem persists.
I will working.
-
20. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
marius.bogoevici May 14, 2010 12:07 AM (in response to vlad_pax)Vladimir,
If you're using JBoss AS 5.x, try this:
1) download Snowdrop from http://jboss.org/snowdrop and include the snowdrop-vfs.jar in your application
2) use
in bean-ref-context.xml (instead of ClassPathXmlApplicationContext) as explained in http://docs.jboss.org/snowdrop/1.0/html/ch02.html#d0e70)
Spring 2.5.6 cannot scan the CP for classes in JBoss AS 5 due to a bug explained in the same doc.
Hope that helps - for any other questions - feel free to ask.
Marius
-
21. Re: @Autowiring of beans from Spring applicationcontext (ejb module)
vlad_pax May 15, 2010 12:26 AM (in response to marius.bogoevici)Hi Marius:
Thank you, very nice.
I'm test with the next configuration:
beanRefContext.xml File:
<bean id="context"
class="org.jboss.spring.vfs.context.VFSClassPathXmlApplicationContext">
<constructor-arg index="1">
<list value-type="java.lang.String" >
<value>applicationContext-log4j.xml</value>
<value>applicationContext-service.xml</value>
<value>sessionFactory-sc-context.xml</value>
<value>dataSource-sc-context.xml</value>
</list>
</constructor-arg>
<constructor-arg index="2" type="boolean">
<value>false</value>
</constructor-arg>
</bean>I have the next error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'context' defined in URL [vfs:/D:/Java/AppsServers/Jboss/jboss-6.0.0.20100429-M3/server/default/deploy/armonica-ear-1.0-SNAPSHOT.ear/APP-INF/lib/armonica-negocio-1.0-SNAPSHOT.jar/beanRefContext.xml]: 2 constructor arguments specified but no matching constructor found in bean 'context' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:181)I will test with Jboss 5, but tomorrow.
Muchas gracias mi hermano.