You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Every servlet (or filter) is required to be a @singleton. If you cannot annotate the class directly, you must bind it using bind(..).in(Singleton.class), separate to the filter() or servlet() rules. Mapping under any other scope is an error. This is to maintain consistency with the Servlet specification. Guice Servlet does not support the deprecated SingleThreadModel.
We use binder().requireExplicitBindings() in order to avoid missing any bindings. This ensures we explicitly add their scope.
However, when the module is a ServletModule, this restriction doesn't seem to work.
One possible reason I could think of is that internally in Guice Servlet, ServletDefinition is the main entity and HttpServlet is mostly used as a proxy, so no injections are actually taking place for it to be explicitly bound.
The text was updated successfully, but these errors were encountered:
We use binder().requireExplicitBindings() in order to avoid missing any bindings. This ensures we explicitly add their scope.
However, when the module is a ServletModule, this restriction doesn't seem to work.
One possible reason I could think of is that internally in Guice Servlet, ServletDefinition is the main entity and HttpServlet is mostly used as a proxy, so no injections are actually taking place for it to be explicitly bound.
The text was updated successfully, but these errors were encountered: