This is my jersey config class
@ApplicationPath("services")
public class JerseyApplication extends ResourceConfig{
public JerseyApplication() {
packages("com.ems");
register(EmployeeService.class);
}
}
Here autowiring
of employeeService
is giving a null pointer exception
@Path("/ems")
@Component
public class EmployeeRestController {
@Autowired
private EmployeeService employeeService;
@GET
@Path("/employees")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public List<Employee> getEmployees() {
return employeeService.getEmployees();
}
}
I have tried everything
In my employeeServiceImpl
I have @service annotation
Still, it is not working.