小编Nit*_*pta的帖子

无法解决此问题 UnsatisfiedDependencyException:SystemInjecteeImpl 处没有可用于注入的对象

我已经尝试了很多方法来解决这个问题,但没有成功。我发现,如果我们使用“abstractBinder”,那么这可以解决,但是一旦我的 Binder 就位,我就开始出现 404 错误。

UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl
Run Code Online (Sandbox Code Playgroud)

请帮忙

我的资源:

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.walmart.services.helpers.IUserService;
import com.walmart.services.helpers.ServicesTest;

@Path("/sayHello")
public class ControllerTest {

    @Inject
    private IUserService service;

    @Inject
    private ServicesTest service2;

    @GET
    @Path("/{name}")
    @Produces(MediaType.TEXT_PLAIN)
    public String method(@PathParam("name") String msg) {
        return service.method() + " msg";
    }

    @GET
    @Path("/v2/{name}")
    @Produces(MediaType.TEXT_PLAIN)
    public String method2(@PathParam("name") String msg) {
        return service2.method() + " msg";
    }
}
Run Code Online (Sandbox Code Playgroud)

我的资源配置文件:

@ApplicationPath("/rest/*")
public …
Run Code Online (Sandbox Code Playgroud)

jersey jersey-2.0 hk2 tomcat9 java-ee-8

5
推荐指数
1
解决办法
6459
查看次数

标签 统计

hk2 ×1

java-ee-8 ×1

jersey ×1

jersey-2.0 ×1

tomcat9 ×1