[ 
https://issues.apache.org/jira/browse/SHIRO-318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080969#comment-13080969
 ] 

Jared Bunting commented on SHIRO-318:
-------------------------------------

The simple @Inject ServletContext is what binds to the "deprecated api".  So, 
an alternative would be to bind our filters to some sort of "ServletContext" 
scope so that it's not a singleton, but right now Guice is attempting to inject 
the ServletContext into our filters before guice-servlet has actually 
registered the ServletContext - hence the warning.  

Another option is to make our filters non-eager, but that's something that can 
be overridden easily at Injector-creation time.

The option that I decided to go with is to bind our own ServletContext at 
binding-time, and rely on that.

> Guice integration causes a warning from guice-servlet
> -----------------------------------------------------
>
>                 Key: SHIRO-318
>                 URL: https://issues.apache.org/jira/browse/SHIRO-318
>             Project: Shiro
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Jared Bunting
>             Fix For: 1.2.0
>
>
> We see this:
> Aug 5, 2011 12:28:49 PM
> com.google.inject.servlet.InternalServletModule$BackwardsCompatibleServletContextProvider
> get
> WARNING: You are attempting to use a deprecated API (specifically,
> attempting to @Inject ServletContext inside an eagerly created
> singleton. While we allow this for backwards compatibility, be warned
> that this MAY have unexpected behavior if you have more than one
> injector (with ServletModule) running in the same JVM. Please consult
> the Guice documentation at
> http://code.google.com/p/google-guice/wiki/Servlets for more
> information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to