berndhopp / guice

guice-integration for the vaadin-framework
https://vaadin.com/directory#!addon/guice-vaadin-integration
10 stars 7 forks source link

allow overriding injector creation in GuiceVaadinServlet #10

Closed mviktorov closed 6 years ago

mviktorov commented 7 years ago

This commit introduces one protected method to allow overriding injector creation in GuiceVaadinServlet. This helps when there is already a prepared Guice Injector in the application used by some other component and it is required to reuse its contents and state in the Vaadin app. My original use-case: The app consists of two parts: Jersey-based REST API and Vaadin Admin UI App. I use com.squarespace.jersey2-guice to install Guice injector into Jersey in a servlet context listener and I need the services in that Injector to be accessible in my Vaadin Admin App. So I put my injector creation method into a static java singleton and install it to the both places:

berndhopp commented 6 years ago

sorry for the late answer. I would rather make the existing injector public in some way, like through a static method, than to meddle with "replacing" it from the outside.