Search code examples
javajax-rsresteasy

JAX-RS with RESTeasy: automatic scanning of resources?


https://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/

These RESTeasy docs say:

"Since we're not using a jax-rs servlet mapping, we must define an Application class that is annotated with the @ApplicationPath annotation. If you return any empty set for by classes and singletons, your WAR will be scanned for JAX-RS annotation resource and provider classes."

Yet there's a configuration switch called resteasy.scan for which it is described:

"Automatically scan WEB-INF/lib jars and WEB-INF/classes directory for both @Provider and JAX-RS resource classes (@Path, @GET, @POST etc..) and register them"

...so if I want to automatically have my resources scanned without needing to list them in web.xml, or having to manually add their classes to the list of Singletons in my class that extends Application... which of these should I obey? Because it seems like these two overlap, except for the fact that the resteasy.scan prop also includes jars.

Also, I take it that resteasy.scan.resources is the exact same as resteasy.resources, only it doesn't scan jars? How would I know that these scan properties even worked, aside from the fact that everything doesn't return a 404?


Solution

  • So I couldn't have known this until enabling proper log4j logging (as the documentation doesn't even mention this):

    RESTEASY002150: resteasy.scan is no longer supported.  Use a servlet 3.0 container and the ResteasyServletInitializer
    

    That's outlined in the documentation here:

    http://docs.jboss.org/resteasy/docs/3.0.17.Final/userguide/html_single/index.html#d4e113

    Really wish they would have updated their docs to not list this property when it doesn't even work... but oh well.