[weld-dev] Circular dependencies between dependent bean constructors

Gavin King gavin.king at gmail.com
Sun Apr 11 00:07:18 EDT 2010


It's the nature of @Dependent scope that two injection points never
refer to the same instance, and that circularities are therefore an
impossibility.

On Fri, Apr 9, 2010 at 3:29 AM, Pete Muir <pmuir at redhat.com> wrote:
> Further, Stuart and I are wondering if "(Beans with scope @Dependent never have circular dependencies.)" from 5.4 means that dependent beans are not allowed to have circular dependencies (definition error) or whether it means that they just don't have circular deps (and that the container must break the circularity.
>
> On 9 Apr 2010, at 09:06, Pete Muir wrote:
>
>> class Foo {
>>
>>   @Inject
>>   Foo (Bar bar) {}
>> }
>>
>> class Bar {
>>
>>   @Inject
>>   Bar (Foo foo) {}
>>
>> }
>>
>> The spec implies that this circularity is breakable without a proxy, but I never saw a good way to do it.
>>
>> Any ideas?
>>
>> This relates to https://jira.jboss.org/jira/browse/WELD-479 which I don't believe is the intent of the spec.
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>



-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list