What exactly is the ResourceConfig class in Jersey 2?

Viewed 57092

I have seen a lot of Jersey tutorials that starts with something like

@ApplicationPath("services")
public class JerseyApplication extends ResourceConfig {
    public JerseyApplication() {
        packages("com.abc.jersey.services");
    }
}

without explaining what exactly the ResourceConfig class is. So where can I find its documentation, usage, etc.? Googling for "jersey resourceconfig" does not yield any official doc.

Some of my questions about this class and its usage are:

  • What things can I do inside the subclass of ResourceConfig?
  • Do I need to register the subclass of ResourceConfig somewhere so that it can be found or is it automatically detected by Jersey?
  • If the subclass is automatically detected what happens if I have multiple subclasses of ResourceConfig?
  • Is the purpose of ResourceConfig the same as the web.xml file? If so what happens if I have both in my project? Does one of them take precedence over the other?
1 Answers
Related