我正在尝试@Named
为 中的绑定 String 进行注入ServeContextListener
,但是我总是知道 String 不是绑定异常。所以我猜ServeContextListener
它不会启动。
这是我的web.xml配置:
<!-- GAE-Shiro -->
<context-param>
<param-name>user-base-url</param-name>
<param-value>/user/admin</param-value>
</context-param>
<context-param>
<param-name>static-base-url</param-name>
<param-value></param-value>
</context-param>
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.jboss.errai.ui.demo.server.guice.ServeContextListener</listener-class>
</listener>
<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- JBoss Resteasy -->
<context-param>
<param-name>resteasy.guice.modules</param-name>
<param-value>org.jboss.errai.ui.demo.server.guice.ServeModule</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener
</listener-class>
</listener>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/</param-value>
</context-param>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
实际绑定在ServeLogic
:
@Override
protected Injector getInjector() {
return Guice.createInjector(new ServeLogic(userBaseUrl, staticBaseUrl), new ServeModule(userBaseUrl));
}
唯一受到约束的是那些在resteasy.guice.modules
:
org.jboss.errai.ui.demo.server.guice.ServeModule
这是为什么?