SpringBoot: No injection source found for a parameter

May 24, 2019

I'm trying an example Spring Boot project with jersey for REST services. I got the following error:

No injection source found for a parameter of type public javax.ws.rs.core.Response 
com.example.jersey.UserResource.updateUser(int,com.example.jersey.User) throws 
java.net.URISyntaxException

My service is defined as:

@PUT
@Path("/{id}")
@Consumes("application/json")
@Produces("application/json")
public Response updateUser(@PathParam("id") int id, User user) throws URISyntaxException
{
   // implementation
}

The problem was caused because Eclipse prompts with the wrong PathParam import first. I had

import javax.websocket.server.PathParam;

I needed to have:

import javax.ws.rs.PathParam;

References