Message from discussion
Recursive binding in Guice
Received: by 10.224.201.7 with SMTP id ey7mr5761384qab.0.1335640238666;
Sat, 28 Apr 2012 12:10:38 -0700 (PDT)
X-BeenThere: google-guice@googlegroups.com
Received: by 10.224.182.133 with SMTP id cc5ls3001513qab.6.gmail; Sat, 28 Apr
2012 12:10:36 -0700 (PDT)
Received: by 10.224.106.66 with SMTP id w2mr5743576qao.4.1335640236621;
Sat, 28 Apr 2012 12:10:36 -0700 (PDT)
Received: by 10.224.21.143 with SMTP id j15msqab;
Sat, 28 Apr 2012 11:21:09 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.52.36.136 with SMTP id q8mr348366vdj.17.1335637268160; Sat, 28
Apr 2012 11:21:08 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
fireball...@gmail.com designates internal as permitted sender)
smtp.mail=fireball...@gmail.com; dkim=pass
header...@gmail.com
Received: by d4g2000vbn.googlegroups.com with HTTP; Sat, 28 Apr 2012 11:21:08
-0700 (PDT)
Date: Sat, 28 Apr 2012 11:21:08 -0700 (PDT)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like
Gecko) Chrome/14.0.835.186 Safari/535.1,gzip(gfe)
Message-ID: <98ca629e-7fe0-4e9c-a2fd-7acf64cac326@d4g2000vbn.googlegroups.com>
Subject: Recursive binding in Guice
From: Adio <fireball...@gmail.com>
To: google-guice <google-guice@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi every one, i am totally new to Guice - In DI frameworks in general
- . Now i am facing a dilemma witch is how to bind and create with
guice object that has dependency injection ? and here is what i mean
@Inject
public class A {
private B b ;
public A(B b){
this.b=b;
}
}
public class B {
private A a ;
@Inject
public B(A a){
this.a = a;
}
and here is a real situation of my problem, actually it is the MVP GWT
pattern design using UiBinding.
public class LoginPresenterImpl implements LoginPresenter {
private HasHandlers eventBus;
private LoginFormErrorMessages errorMessages;
private UserAccountServiceAsync async;
private LoginView loginDisplay;
@Inject
public LoginPresenterImpl(UserAccountServiceAsync serviceAsync,
LoginView loginview, HasHandlers handlerManager,
LoginFormErrorMessages loginFormErrorMessages) {
async = serviceAsync;
loginDisplay = loginview;
eventBus = handlerManager;
errorMessages = loginFormErrorMessages;
}
......
}
and the LoginView is :
public class LoginViewImpl extends Composite implements LoginView {
@UiTemplate("LoginView.ui.xml")
interface LoginViewUiBinder extends UiBinder<DecoratorPanel,
LoginViewImpl> {
}
@UiField
TextBox username;
@UiField
PasswordTextBox password;
@UiField
Button login;
@UiField
Button newRegistration;
@UiField
Label warningLabel;
private LoginViewUiBinder binder =
GWT.create(LoginViewUiBinder.class);
@Inject
private LoginPresenter loginPresenter;
public LoginViewImpl() {
initWidget(binder.createAndBindUi(this));
}
......
}
how to binde the view ??? and the Presenter ?