【发布时间】:2012-11-18 12:12:40
【问题描述】:
我正在使用 Guice 连接 Jetty 服务器,我想通过 Apache Shiro 添加一些安全性。
似乎 Shiro 需要配置 ServletContext,但问题是我在配置时没有 ServletContext(例如在 ServletModule 作为文档状态)。 ServletContext 在 GuiceServletContextListener 中可用,但是此时,我的注入器已经创建,所以安装 Shiro 模块为时已晚。
我尝试通过 Guice 提供程序将 ServletContext 提供给 Shiro,(Provider
"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."
在注入器创建后如何安装 Shiro Web 模块?
【问题讨论】:
标签: java apache jetty guice shiro