No injection source found for a parameter of type public javax.ws.rs.core.Respons

Marco Hernandez2 years ago

hello everyone, I'm trying to enter @FormDataParam to receive a file, I do it with jersey and the dependencies are added correctly, the problem is when running it gives me the error "No injection source found for a parameter of type public javax.ws.rs.core.Respons", I found on the internet that I should do this configuration but I don't know where, will someone know?

this is the configuration found on internet -> documentation jersey

Example 9.44. Building client with MultiPart feature enabled.

final Client client = ClientBuilder.newBuilder()
    .register(MultiPartFeature.class)
    .build();

Example 9.45. Creating JAX-RS application with MultiPart feature enabled.

final Application application = new ResourceConfig()
    .packages("org.glassfish.jersey.examples.multipart")
    .register(MultiPartFeature.class)

this is the file with @FormDataParam:

import org.glassfish.jersey.media.multipart.FormDataParam;
....
    @POST
    public Response add(@NotEmpty @FormDataParam("file") String file
    ) throws StorageException {
        System.out.println("hola"+file);
        return Response.ok().status(200).build();

    }

and this is the dependency that i use for multipart

build.gradle

dependencies {
    ...
    implementation "org.glassfish.jersey.media:jersey-media-multipart:$jerseyVersion"
}
Anton Tananaev2 years ago

Please don't create multiple topics about the same thing.