google / google/guice

Injecting ServletContext while not using GuiceServletContextListener leads to logspam

Open
#840 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

GuiceServletContextListener is optional per the [docs](https://github.com/google/guice/wiki/ServletModule):

Note that it is not necessary to use a ServletContextListener to use Guice Servlet, as long as you remember to install ServletModule when creating your injector.

However if one does this (installing a ServletModule in a manually-created injector) then injecting ServletContext at request-time leads to a [warning](https://github.com/google/guice/blob/master/extensions/servlet/src/com/google/inject/servlet/InternalServletModule.java#L68) as if we were injecting it at singleton-creation-time.
This is because the BackwardsCompatibleServletContextProvider relies on GuiceServletContextListener to give it the current injector.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.