注入@Default服务

时间:2018-06-19 11:20:13

标签: java-ee cdi weld

我有以下代码:

@Stateless
public class Service {
....

   @Inject
   private Translator <Customer> translator;

....
}


@Default
@ApplicationScoped
public class TheTranslator extends Translator <Customer> {...}

如果我删除@ApplicationScoped

我收到此错误:

java.io.IOException:      com.sun.enterprise.admin.remote.RemoteFailureException:部署期间发生错误:加载应用程序时发生异常:CDI部署失败:WELD-001408:具有限定符@Default的类型Translator的依赖关系未满足   在注入点[BackedAnnotatedField] @Inject @Default私有com.company.translator   在com.companyService.translator(Service.java:0)

0 个答案:

没有答案