Hello together can someone explain me what i am doing wrong. I am relatively new to CDI and i try to understand it.
I read this post (
https://vaadin.com/forum/#!/thread/8466915/8466914
) completely but it doesn’t help me.
I am using the MVP-Pattern of Matti (
https://github.com/peterl1084/cdiexample
)
So i have a LoginViewImpl as CDIView:
@CDIView(LoginView.ID)
public class LoginViewImpl extends AbstractView<LoginViewPresenter>implements LoginView {
private static final long serialVersionUID = 1L;
@Inject
private Instance<LoginViewPresenter> presenterInstance;
@Inject
private LangProvider langProvider;
@Inject
private TextBundle textBundle;
...
public LoginViewImpl() {
super();
initLayout();
}
...
}
and an interface
[code]
public interface LoginView extends ApplicationView {
public static final String ID = "";
void loginFailed();
void showNoAccountNotification();
}
[/code]and the presenter
@UIScoped
public class LoginViewPresenter extends AbstractPresenter<LoginView> {
@EJB
private PersonServiceLocal personService;
@Inject
private Event<NavigationEvent> navigationEvent;
@Inject
private LangProvider langProvider;
...
}
The LangProvider in the CDIView is this:[code]
@UIScoped
public final class LangProvider implements Serializable, TextBundle {
private static final long serialVersionUID = 1L;
public static final Locale DE_DE = new Locale("de", "DE");
public static final Locale EN_GB = new Locale("en", "GB");
private ResourceBundle resourceBundle;
…
}
[/code]I tried to inject the LangProvider in the view (LoginViewImpl) and the presenter (LoginViewPresenter). The LangProvider is only injected correctly in the Presenter. In the View the LangProvider is always null. What i am doing wrong?