[weld-dev] Circular dependencies between dependent bean constructors

Stuart Douglas stuart at baileyroberts.com.au
Sun Apr 11 01:24:30 EDT 2010


Should this be detected as an error at deployment time? 

I don't think that letting a user run into a StackOverflowError is particularly friendly, but the spec does not explicitly state that the continer is required to detect this (unless I am missing something, which is often the case). 

Stuart


________________________________________
From: weld-dev-bounces at lists.jboss.org [weld-dev-bounces at lists.jboss.org] On Behalf Of Gavin King [gavin.king at gmail.com]
Sent: Sunday, 11 April 2010 3:08 PM
To: Marius Bogoevici
Cc: Pete Muir; Weld-Dev List
Subject: Re: [weld-dev] Circular dependencies between dependent bean    constructors

On Sat, Apr 10, 2010 at 11:18 PM, Marius Bogoevici
<marius.bogoevici at gmail.com> wrote:
>
> On 2010-04-11, at 12:07 AM, Gavin King wrote:
>
>> It's the nature of @Dependent scope that two injection points never
>> refer to the same instance, and that circularities are therefore an
>> impossibility.
>
> Gavin, could you clarify that? From reading your comment, it seems like this use case
> implies unbound recursion: Foo injects Bar which in turns injects another instance of Foo
> (which is dependent on the first instance of Bar) which injects another instance of Bar etc.

Well, exactly. I mean, that's obvious from the definition of an
@Dependent object, right?

I mean, I don't quite follow what the source of doubt here is. Section
6.4 is *very* explicit on this.



--
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org
_______________________________________________
weld-dev mailing list
weld-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev


More information about the weld-dev mailing list