Why is resteasy.providers still required when using Spring with @Provider annotations?

I have a Restaasy application that uses Spring and contains ContainerRequestFilter and ContainerResponseFilter implementations annotated with @Provider . The application uses version 3.0-beta-6 Resteasy.

These filters work as expected when they are added to the resteasy.providers context resteasy.providers in web.xml as follows:

 <context-param> <param-name>resteasy.providers</param-name> <param-value>foo.filter.LoggingRequestFilter, foo.filter.LoggingResponseFilter</paramvalue> </context-param> 

If I remove the filters, they will no longer be called.

I assumed that these providers automatically register with Resteasy when using org.jboss.resteasy.plugins.spring.SpringContextLoaderListener . The strange thing for me is that it worked for PreProcessInterceptor implementations in previous versions of Resteasy and still works in v3, but Filters and ExceptionMappers are not automatically registered.

Questions

  • Why is the resteasy.providers context resteasy.providers needed if classes are annotated with @Provider and scanned with Spring?
  • Is there a software way to install these providers at runtime?
+7
source share
1 answer

To find suppliers scanned by Spring, I had to add the includeFilters parameter to @ComponentScan in my Spring Java configuration class.

 @ComponentScan(value = "com.foo", includeFilters = @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Provider.class)) 

You can also simply annotate them with @Component along with @Provider and Spring to ensure that they are detected by Resteasy when using Resteasy SpringContextLoaderListener .

+6
source

All Articles