title: @Provider AND Registration in Application(ResourceConfig) requirement for custom MessageBodyWriter/Reader?
body: <p>Is there a requirement that a custom MessageBodyWriter and MessageBodyReader must not only be annotated by <em>@Provider</em> annotation AND also be included in the <em>Application</em> configuration through <em>Application</em> or <em>ResourceConfig</em>. If yes, why? </p>
  
  <p>My train of thought was that, if classes are annotated with <em>@Provider</em> then the JAX-RS runtime by default loads such classes as it's runtime component. Declaring the same class inside the <em>Application</em> makes is a redundant exercise. It appears my train of thought is wrong, but I am looking for some kind of explanation on how and why this has been designed this way(ie both annotation and Application configuration).</p>
  
  <p>I can understand that some form of Application configuration would be required on the Jersey Client side, but am not very confident about that either.</p>
  
  <p>For instance, the JavaMarshaller class below has been annotated with @Provider</p>
  
  <pre><code>import javax.ws.rs.ext.MessageBodyReader;
  import javax.ws.rs.ext.MessageBodyWriter;
  import javax.ws.rs.Consumes;
  import javax.ws.rs.Produces;
  import javax.ws.rs.ext.Provider;
  
  @Provider
  @Produces("application/example-java")
  @Consumes("application/example-java")
  public class JavaMarshaller implements MessageBodyReader, MessageBodyWriter {
  .......
  </code></pre>
  
  <p>Now in the Application class is it required to do as below?</p>
  
  <pre><code>@ApplicationPath("services")
  public class ShoppingApplication extends Application {
      private Set&lt;Object&gt; singletons = new HashSet&lt;Object&gt;();
      private Set&lt;Class&lt;?&gt;&gt; classes = new HashSet&lt;Class&lt;?&gt;&gt;();
  
      public ShoppingApplication() {
          classes.add(JavaMarshaller.class);
      }
  
  .........
  </code></pre>