title: How to enable FEATURE_POJO_MAPPING using jersey 2.0 and servlet 3.0 without a web.xml?
body: <p>I want to use the @JsonAnySetter feature to collecut unknowns when receiving JSON, so I added the annotated method to my class (which is annotated with @XmlRootElement) and</p>
  
  <pre><code>&lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.api.json.POJOMappingFeature&lt;/param-name&gt;
    &lt;param-value&gt;true&lt;/param-value&gt;
  &lt;/init-param&gt;
  </code></pre>
  
  <p>to my web.xml.  This works fine.</p>
  
  <p>I decided to try and get rid of my web.xml.</p>
  
  <p>I changed my class to </p>
  
  <pre><code>import org.glassfish.jersey.server.ResourceConfig;
  
  @ApplicationPath("/services")
  public class ListingRS extends ResourceConfig {
  
      public ListingRS() {
          packages("com.onlineimage.totalproperties");
      }
  </code></pre>
  
  <p>and everything works except the @JsonAnySetter is never called.</p>
  
  <p>I tried to add getFeatures() as I found in an example</p>
  
  <pre><code>public ListingRS() {
      packages("com.onlineimage.totalproperties");
      getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
  }
  </code></pre>
  
  <p>but getFeatures() is not recognized and I think it's Jersey 1.x? </p>
  
  <p>I changed it to</p>
  
  <pre><code>public ListingRS() {
      packages("com.onlineimage.totalproperties");
      getProperties().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
  }
  </code></pre>
  
  <p>but I dont have an import for JSONConfiguration and I cant figure out what to import with Jersey 2.0.  Also I'm not sure that getProperties() is the correct way to do this.</p>
  
  <p>for my Gradle libraries I'm using</p>
  
  <pre><code>List compileLibraries =['org.glassfish.jersey.core:jersey-common:2.0',
                          'org.glassfish.jersey.core:jersey-server:2.0']
  </code></pre>
  
  <p>The root of the issue is, I want to use @XmlRootElement on my class for the easy xml converting and @JsonAnySetter to handle unknowns.
  The @JsonAnySetter method is never called if I don't enable JSONConfiguration.FEATURE_POJO_MAPPING.</p>
  
  <p>Assuming I'm not doing something horribly wrong in the above, how to I enable JSONConfiguration.FEATURE_POJO_MAPPING without the web.xml file?</p>