gre*_*ker 8 java spring web.xml jax-rs resteasy
我有一个Resteasy应用程序,它使用Spring并包含ContainerRequestFilter和ContainerResponseFilter实现注释@Provider.该应用程序正在使用3.0-beta-6Resteasy 版本.
这些过滤器在添加到resteasy.providersweb.xml中的context参数时按预期工作,如下所示:
<context-param>
<param-name>resteasy.providers</param-name>
<param-value>foo.filter.LoggingRequestFilter,
foo.filter.LoggingResponseFilter</paramvalue>
</context-param>
Run Code Online (Sandbox Code Playgroud)
如果我从这里删除过滤器,则不再调用它们.
我假设这些提供商在使用时会自动注册Resteasy org.jboss.resteasy.plugins.spring.SpringContextLoaderListener.对我来说奇怪的是它适用PreProcessInterceptor于以前版本的Resteasy中的实现,并且仍然适用于v3,但Filters和ExceptionMappers不会自动注册.
resteasy.providers如果使用@ProviderSpring 对类进行注释和扫描,为什么需要上下文参数?为了让Spring扫描提供程序,我必须在Spring Java配置类中添加includeFilters参数@ComponentScan.
@ComponentScan(value = "com.foo",
includeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Provider.class))
Run Code Online (Sandbox Code Playgroud)
你也可以标注他们@Component沿@Provider和Spring将确保使用RestEasy的公司时,他们得到的RestEasy的检测SpringContextLoaderListener.
| 归档时间: |
|
| 查看次数: |
5167 次 |
| 最近记录: |