I try to add this line, but it doesn't work. I try to test a simple service binding in guice module, it works well with : @Inject ITestService testService;
Thanks. On Tue, Aug 18, 2009 at 12:01 AM, Arie Fishler <[email protected]> wrote: > in the ctor just add this line > > InjectorHolder.*getInjector*().inject(*this*); > > > On Mon, Aug 17, 2009 at 6:26 PM, Haulyn R. Jason <[email protected] > >wrote: > > > Hi, all: > > I have a class which is likes below: > > > > > > public class DetachableMemberModel extends > LoadableDetachableModel<Member> > > { > > > > private final long id; > > > > public DetachableMemberModel(Member m) { > > this(m.getId()); > > } > > > > public DetachableMemberModel(long id) { > > if (id == 0) { > > throw new IllegalArgumentException(); > > } > > this.id = id; > > } > > > > @Override > > public int hashCode() { > > return Long.valueOf(id).hashCode(); > > } > > > > @Override > > public boolean equals(final Object obj) { > > if (obj == this) { > > return true; > > } else if (obj == null) { > > return false; > > } else if (obj instanceof DetachableMemberModel) { > > DetachableMemberModel other = (DetachableMemberModel) obj; > > return other.id == id; > > } > > return false; > > } > > > > @Override > > protected Member load() { > > // I do not know how to inject this service to > > Object DetachableMemberModel > > return memberService.query(id); > > } > > } > > > > please see the last method of this class, I do not know how to inject > > memberService to this class. > > If I use @Inject private MemberService memberService, I have to inject > this > > class to the WebPage, but I can not bind DetachableMemberModel to any > > interface. > > > > So, I do not know to to implement this, can anybody help me? Thanks very > > much. > > > > -- > > ------------------ > > Enjoy. Thanks! > > > > Haulyn Microproduction > > > > Mobile: +086-15864011231 > > email: [email protected], > > [email protected] > > website: http://haulynjason.net > > gtalk: [email protected] > > yahoo: [email protected] > > msn: [email protected] > > skype: saharabear > > QQ: 378606292 > > > > Haulyn Jason > > > -- ------------------ Enjoy. Thanks! Haulyn Microproduction Mobile: +086-15864011231 email: [email protected], [email protected] website: http://haulynjason.net gtalk: [email protected] yahoo: [email protected] msn: [email protected] skype: saharabear QQ: 378606292 Haulyn Jason
