On Fri, Oct 10, 2008 at 8:56 AM, Ramkumar R <[EMAIL PROTECTED]> wrote:

> Hi All,
> I came across this requirement, while working with Spring, but I believe
> this topic also holds good for Java implementations.
>
> Spring supports Constructor Injection by allowing to inject properties and
> objects via the constructors. Not sure if Tuscany should support this
> feature? As SCA+Spring depends on Tuscany runtime for binding and dependency
> injections.
>
> I believe currently Tuscany supports injection of service references
> through getter & setter methods.
>
> This question arises because the biggest benefit of setter injection is
> that it allows for circular dependencies. Circular dependencies are actually
> pretty common. If you have a UserService that needs to get information about
> an employer from CompanyService and the CompanyService needs information
> about employees from UserService, right there you have a circular
> dependency. In general I find a lot of circular dependencies between service
> methods, but with complex object models it is possible to have circular
> dependencies elsewhere.
>
> So considering the circular dependency issue, I believe it would be a bad
> idea to support the same in Tuscany.
>
> Like to hear from the community for more insight on this topic and how we
> should go about it.
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Tuscany injects proxies into references rather than the target object itself
so we could leverage that to solve the cyclic reference case. The Java
Component Implementation Specification describes some cyclic reference
strategies around line 259.

I imagine the same consideration needs to be given to spring assuming that
the SCA Spring specification calls for this feature. The spec is so thin
it's difficult to tell. What does the code do at the moment?

Regards

Simon

Reply via email to