multibind into named thing

23 views
Skip to first unread message

Mats Svefors

unread,
Jul 8, 2013, 12:12:25 PM7/8/13
to sil...@googlegroups.com
Hello,

I have:

interface A

B implements A {
   public B(A[])
}

C implements A{}
D implements A{}

Module1:
bind(left, A.class).to(B.class)
bind(right, A.class).to(B.class)

then I want to add different A:s inside a named B.

Module2:
injectInto(left, B.class).multibind(A.class).to(C.class)

Module3:
injectInto(left, B.class).multibind(A.class).to(D.class)

But I get a "Cycle detected". I also tried with "within(left, B.class).multibind(A.class).to(D.class) with the same result.

So... how am I doing it wrong?

Mats

Mats Svefors

unread,
Jul 8, 2013, 2:27:14 PM7/8/13
to sil...@googlegroups.com
My bad... I forgot to install the module with the binding. 

Mats

jan

unread,
Jul 8, 2013, 2:48:00 PM7/8/13
to sil...@googlegroups.com
Ok. But I think you don't get what I assume you want with the bindings given. Let me know if the problem remains.

jan

unread,
Jul 8, 2013, 3:32:06 PM7/8/13
to sil...@googlegroups.com
I added a test that shows how to resolve the situation (as I understood your intent) currently https://github.com/jbee/silk/blob/master/src/test/se/jbee/inject/bind/TestIssue1.java
It is a bit difficult currently since the created B is not excluded automatically from the A's passed to it. I might consider adding this automatically.

/Jan
Reply all
Reply to author
Forward
0 new messages