Guiceを使用してJettyサーバーを配線していますが、 Apache Shiroでセキュリティを追加したいと考えています。
Shiro にはServletContextを構成する必要があるようですが、問題は、構成時に ServletContext を持っていないことです (たとえば、ドキュメントに記載されているServletModule内)。ServletContextはGuiceServletContextListenerで利用できますが、現時点では、私のインジェクターは既に作成されているため、Shiroモジュールをインストールするには遅すぎます。
Guiceプロバイダー ( Provider<ServletContext> )を介してShiroにServletContextを提供しようとしましたが、まだ成功していません。このプロバイダーは、作成後に ServletContext を提供すると思いました。これにより、警告も表示されます。
"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 モジュールをどのようにインストールできますか?