我有一个 Resteasy 应用程序,它使用 Spring 并ContainerRequestFilter
包含ContainerResponseFilter
用@Provider
. 该应用程序使用3.0-beta-6
的是 Resteasy 版本。
这些过滤器在添加到resteasy.providers
web.xml 中的 context 参数时按预期工作,如下所示:
<context-param>
<param-name>resteasy.providers</param-name>
<param-value>foo.filter.LoggingRequestFilter,
foo.filter.LoggingResponseFilter</paramvalue>
</context-param>
如果我从这里删除过滤器,它们将不再被调用。
我假设这些提供者在使用org.jboss.resteasy.plugins.spring.SpringContextLoaderListener
. 对我来说奇怪的是,它适用PreProcessInterceptor
于以前版本的 Resteasy 中的实现,并且仍然适用于 v3,但过滤器和异常映射器不会自动注册。
问题
resteasy.providers
如果类是@Provider
用 Spring 注释和扫描的,为什么需要 context 参数?- 是否有在运行时设置这些提供程序的编程方式?