我正面临注射问题。
我已经删除了文件以提供我正在做的事情的基本概述。
UsersApi.java(REST服务)
package com.example.api;
@Path("/users")
@RequestScoped
public class UsersApi {
@Inject
private UsersService delegate;
@GET
@Path("/{lanId}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response userDetails(userID,httpServletRequest){
Response userDetails= delegate.userDetails(userID,httpServletRequest);
return Response.ok(userDetails,MediaType.APPLICATION_JSON_TYPE).build();
}
}
UsersService.java
package com.example.api;
public interface UsersService {
public Response userDetails(String lanId, HttpServletRequest httpServletRequest);
}
UsersServiceImpl.java
package com.example.api.impl;
@Stateless
public class UsersApiServiceImpl implements UsersApiService {
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Response userDetails(String lanId, HttpServletRequest httpServletRequest) {
System.out.println(lanId);
}
}
当我在weblogic中部署ear文件时,它会抛出
Unsatisfied dependencies for type UsersService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject @Default private com.example.api.UsersApi.delegate at com.example.api.UsersApi.delegate(UsersApi.java:0)