简体   繁体   English

ZZZZ类型与限定符@Default的不满意依赖关系

[英]Unsatisfied dependencies for type ZZZZ with qualifiers @Default

I am have beans as given below. 我有以下给出的豆子。

@Singleton
@DependsOn("DefaultEmailService")
public class CustomerService implements UserHandlingService {

    private DefaultEmailService mailService;

    @Inject
    public CustomerService(DefaultEmailService mailService) {       
        this.mailService = mailService;
    }
}


@Singleton
@Startup
public class DefaultEmailService implements EmailService {

    public DefaultEmailService() {  
    }
}

I get error like 我得到的错误就像

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type DefaultEmailService with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public com.project.service.CustomerService(DefaultEmailService)
  at com.project.service.CustomerService.<init>(CustomerService.java:0)

Am I doing any thing wrong. 我做错了什么。

The problem is the @Singleton annotation, that is from javax.ejb and not javax.inject . 问题是@Singleton注释,即来自javax.ejb而不是javax.inject Using the ejb one and defining the interface your bean is registered on CDI context as the interface, not implementation, change your code: 使用ejb和定义接口,您的bean在CDI上下文中注册为接口,而不是实现,更改您的代码:

@Inject
public CustomerService(EmailService mailService) {
    this.mailService = (DefaultEmailService) mailService;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有限定符 @Default 的类型 EntityManager 的不满意依赖项 - Unsatisfied dependencies for type EntityManager with qualifiers @Default 带有限定符[@Default]的[PartitionManager]类型的依赖关系未满足? - Unsatisfied dependencies for type [PartitionManager] with qualifiers [@Default]? 在注入点使用限定符 @default 的类型的依赖关系不满足 - Unsatisfied dependencies for type with qualifiers @default at injection point 带有限定符@Default的XXXX类型的Arquillian不满意的依赖项 - Arquillian Unsatisfied dependencies for type XXXX with qualifiers @Default DeploymentException:WELD-001408:带有限定符@Default的类型[]的不满意依赖项 - DeploymentException: WELD-001408: Unsatisfied dependencies for type [] with qualifiers @Default WELD-001408:带限定符@Default的ServiceLocator类型的依赖关系未满足 - WELD-001408: Unsatisfied dependencies for type ServiceLocator with qualifiers @Default WELD-001408类型的不满意依赖关系...在注入点使用限定符[@Default] - WELD-001408 Unsatisfied dependencies for type … with qualifiers [@Default] at injection point WELD-001408:带限定符@Default的类型验证器的依赖关系不令人满意 - WELD-001408: Unsatisfied dependencies for type Validator with qualifiers @Default 对类型[***的依赖性不满意 <T> ]在注入点[[field] @Inject处带有限定符[@Default] - Unsatisfied dependencies for type [***<T>] with qualifiers [@Default] at injection point [[field] @Inject WELD-001408:带有限定符 @Default 的类型 Logger 的依赖关系不满足 - WELD-001408: Unsatisfied dependencies for type Logger with qualifiers @Default
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM