java – MULTIPART_FORM_DATA:没有为Response类型的参数找到注入源

参见英文答案 > MULTIPART_FORM_DATA: No injection source found for a parameter of type public javax.ws.rs.core.Response                                    6个
我正在尝试使用multipart / form-data为JAX-RS上传文件.当我尝试启动服务器时,它给了我这个错误:

[[FATAL] No injection source found for a parameter of type public javax.ws.rs.core.Response
com.pododdle.resources.UploadResource.uploadAudio(int,int,java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition)
    at index 2.;source='ResourceMethod{httpMethod=POST, consumedTypes=[multipart/form-data], producedTypes=[text/html], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class 
com.pododdle.resources.UploadResource, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@29d4c93f]}, definitionMethod=public javax.ws.rs.core.Response 
com.pododdle.resources.UploadResource.uploadAudio(int,int,java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition), parameters=[Parameter [type=int, source=auction_id, defaultValue=null], Parameter [type=int, source=category_id, defaultValue=null], Parameter [type=class java.io.InputStream, source=file, defaultValue=null], Parameter [type=class org.glassfish.jersey.media.multipart.FormDataContentDisposition, source=file, defaultValue=null]], responseType=class javax.ws.rs.core.Response}, nameBindings=[]}']

我的pom.xml看起来像这样:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>${jersey.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-multipart</artifactId>
        <version>${jersey.version}</version>
    </dependency>

    <dependency>
        <groupId>org.jvnet.mimepull</groupId>
        <artifactId>mimepull</artifactId>
        <version>1.9.6</version>
    </dependency>

</dependencies>
<properties>
    <jersey.version>2.22.1</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

与版本2.22.1的泽西版本一起使用的mimepull的版本我从这里得到:https://www.versioneye.com/java/org.glassfish.jersey.media:jersey-media-multipart/2.22.1

有什么我缺少,或没有正确配置?我是新手,所以对我很轻松……

上一篇:java – Autowired为null,不适用于Jersey Spring


下一篇:java – JWT发出相同的令牌