title: Jersey 2 multi-part
body: <p>We are having a RESTful webservice that has a resource that accepts multi-part. We are having Jersey2 with Spring 4. I am getting the following exception</p>
  
  <pre><code>&lt;code&gt;
  org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
  [[FATAL] No injection source found for a parameter of type public javax.ws.rs.core.Response xxx.AssetUploadResource.uploadAssetByStream(java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition,java.lang.String) at index 0.; source='ResourceMethod{httpMethod=POST, consumedTypes=[multipart/form-data], producedTypes=[application/json], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class xxx.AssetUploadResource, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@1d63c523]}, definitionMethod=public javax.ws.rs.core.Response xxx.AssetUploadResource.uploadAssetByStream(java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition,java.lang.String), parameters=[Parameter [type=class java.io.InputStream, source=Asset, defaultValue=null], Parameter [type=class org.glassfish.jersey.media.multipart.FormDataContentDisposition, source=asset, defaultValue=null], Parameter [type=class java.lang.String, source=Asset Metadata as a json string, defaultValue=null]], responseType=class javax.ws.rs.core.Response}, nameBindings=[]}']
  &lt;/code&gt;
  </code></pre>
  
  <p>Jersey version is 2.24. Also, the multi-part dependency alongwith init-param in web.xml is added</p>
  
  <pre><code>&lt;code&gt;
  @Api
  @Path("/asset")
  @Component
  public class AssetUploadResource {
  
      @POST
      @Consumes(MULTIPART_FORM_DATA)
      @Produces(APPLICATION_JSON)
      public Response uploadAssetByStream(
              @FormDataParam("asset") InputStream asset,
              @FormDataParam("asset") FormDataContentDisposition assetDetails,
              @FormDataParam("metadata") String metadata) {
  &lt;/code&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;code&gt;
  
   &lt;servlet&gt;
          &lt;servlet-name&gt;jersey-serlvet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;jersey.config.server.provider.classnames&lt;/param-name&gt;
              &lt;param-value&gt;org.glassfish.jersey.media.multipart.MultiPartFeature&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
              &lt;param-value&gt;xxx&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  &lt;/code&gt;
  </code></pre>
  
  <p>Can you please tell me what am I missing?</p>