You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephane Decleire <sd...@cariboo-networks.com> on 2009/05/18 23:58:39 UTC

T5.1: parent/children Spring non singleton beans integration

I've got non singleton beans in a parent/children relation. For example :
- a Folder bean with a property Files which point on a Set of File beans.
- several File beans with a property Folder which point on a Folder bean.

Until Tapestry 5.0.18, i used to implement those non singleton beans as
Spring beans with prototype "scope".
Since Tapestry 5.1, and the new Tapestry/Spring integration, i get an
"unresolvable circular reference" when injecting one of those beans.

I think that i'm not the only one to encounter this common use case.
So i would be glad to hear from others how they have implemented such a
case with Tapestry IOC and/or Spring beans.

Thanks in advance.

Stephane

Re: T5.1: parent/children Spring non singleton beans integration

Posted by Valentin Yerastov <xi...@gmail.com>.

Hello!

I've found following workaround: use external spring context like in T5.0.

I add in web.xml

<context-param>
  <param-name>tapestry.use-external-spring-context</param-name>
  <param-value>true</param-value>
</context-param>

In beans I use it like:

If you want request scope in spring:
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

Define in application context:

<bean id="gisService" class="...GisServiceImpl" scope="request"
lazy-init="true">
    <!-- Tapestry inject nor real bean but proxy, which redirect request to
appropriate scoped bean -->
   <aop:scoped-proxy /> 
</bean>

and inject in Tapestry beans as

@Inject @Service("gisService")
private GisService gisService;


Stephane Decleire wrote:
> 
> I've got non singleton beans in a parent/children relation. For example :
> - a Folder bean with a property Files which point on a Set of File beans.
> - several File beans with a property Folder which point on a Folder bean.
> 
> Until Tapestry 5.0.18, i used to implement those non singleton beans as
> Spring beans with prototype "scope".
> Since Tapestry 5.1, and the new Tapestry/Spring integration, i get an
> "unresolvable circular reference" when injecting one of those beans.
> 
> I think that i'm not the only one to encounter this common use case.
> So i would be glad to hear from others how they have implemented such a
> case with Tapestry IOC and/or Spring beans.
> 
> Thanks in advance.
> 
> Stephane
> 
> 

-- 
View this message in context: http://n2.nabble.com/T5.1%3A-parent-children-Spring-non-singleton-beans-integration-tp2935987p2937338.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org