Hi, I work with legacy web app that have a ojbect in session scope.
I create a new front end with Vaadin and mvp lite that work togheter with
old Struts front end.
Now in my vaadin application class at every request, i create a new
injector with an object because i retrieve a UserContextInfo object from
Session that have some infos of user and db name to use.
private Module createModule(final CreateViewService s) {
Module modules = new AbstractModule() {
@Override
protected void configure() {
bind(EventBus.class).toInstance(eventBus);
// usercontext info get from request
bind(UserContextInfoDecorator.class).toInstance(userContextInfo);
bind(View.class).annotatedWith(ParentViewAnnotation.class).toInstance(s.getParent());
bind(Parameter.class).toInstance(s.getParameters());
bind(SecureValidator.class).toInstance(validator);
}
};
return modules;
}
At every request i create a new injector whit this method and catch the
exact instance of UserContextInfo.
private View createViewInstance(Class<? extends View> clazz, Module
modules) throws GuiException, ProvisionException {
Injector localInjector = Guice.createInjector(modules);
View instance = localInjector.getInstance(clazz);
instance.inizialize(validator);
return instance;
}
It right use of guice? or it's better to exclude instance parameter from
injections? Any suggestion?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/d/optout.