我试图将@Named bean注入jax-rs资源类。但是当我尝试使用accountBc对象时,它始终为null。
我应该怎么做才能将accountbc注入BuildController中?
@Named
@Path("/build")
public class BuildCotroller {
@Inject
@Named("AccountBcImpl")
private AccountBc accountBc;
@GET
@Produces("application/json")
public AccountDto getBuilding(@QueryParam("buildId") Long buildId) throws BaseException {
return accountBc.getAccountByBuildId(buildId);
}
}
AccountBcImpl类
@Named("AccountBcImpl")
public class AccountBcImpl extends AccountBaseBcImpl implements AccountBc {