简体   繁体   English

在注入点使用限定符 @default 的类型的依赖关系不满足

[英]Unsatisfied dependencies for type with qualifiers @default at injection point

I'm working on a project with javaee-7.我正在使用 javaee-7 开发一个项目。 I have developed a new functionality in an external library and now I want to use the logic developed in the library in a micro-service.我在外部库中开发了一个新功能,现在我想在微服务中使用库中开发的逻辑。

Code from library库中的代码

public class Address {
    public void addFormattedAddress(String country) {
        if (country.equals("BR")) {
                object.setFormattedAddress(new AddressFormatterForBR().createAddress(country));
            } else if (country.equals("CN")) {
                object.setFormattedAddress(new AddressFormatterForCN().createAddress(country));
            }
        }
    }

Code from micro-service来自微服务的代码

@Inject
private Address address;
.....
listOfObjects.forEach(object -> responseAddressFormatter.addFormattedAddress(country));

When I want to start the microservice I did the following steps:当我想启动微服务时,我执行了以下步骤:

 1. mvn clean install --> here I received BUILD SUCCESS
 2. docker-compose build --> everything looks fine
 3. docker-compose up ---> here I received this error: 

Exception while loading the app: CDI deployment failure:WELD-001408: Unsatisfied dependencies for type Address with qualifiers @Default webapp_1 |加载应用程序时出现异常:CDI 部署失败:WELD-001408:带有限定符的地址类型的依赖项不满足 @Default webapp_1 | at injection point [BackedAnnotatedField] @Inject private在注入点 [BackedAnnotatedField] @Inject private

It looks like your Address bean is not getting scanned.看起来您的地址 bean 没有被扫描。 Are you sure you don't want to put any annotation on you Address class?您确定不想在地址 class 上添加任何注释吗?

暂无
暂无

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

相关问题 WELD-001408类型的不满意依赖关系...在注入点使用限定符[@Default] - WELD-001408 Unsatisfied dependencies for type … with qualifiers [@Default] at injection point 对类型[***的依赖性不满意 <T> ]在注入点[[field] @Inject处带有限定符[@Default] - Unsatisfied dependencies for type [***<T>] with qualifiers [@Default] at injection point [[field] @Inject WELD-001408:在注入点 [BackedAnnotatedField] @Inject 具有限定符 @Default 的类型 Logger 的依赖关系不满足 - WELD-001408: Unsatisfied dependencies for type Logger with qualifiers @Default at injection point [BackedAnnotatedField] @Inject WELD-001408:在注入点 [BackedAnnotatedField] @Inject 带有限定符 @Default 的 UserService 类型的依赖项不满足 - WELD-001408: Unsatisfied dependencies for type UserService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject 在注入点 [BackedAnnotatedField] @Inject &quot;Implementation&quot; 带有限定符 @Default 的类型“接口”的不满意依赖项 - Unsatisfied dependencies for type "Interface" with qualifiers @Default at injection point [BackedAnnotatedField] @Inject "Implementation" DeploymentException: WELD-001408: 不满意的类型依赖<Class>在注入点使用限定符 @Default [BackedAnnotatedField] - DeploymentException: WELD-001408: Unsatisfied dependencies for type <Class> with qualifiers @Default at injection point [BackedAnnotatedField] 在注入点使用限定符 [@Default] 的类型 [...] 的不满意依赖项(使用带有 CDI 的 @Stateful EJB) - Unsatisfied dependencies for type […] with qualifiers [@Default] at injection point (using @Stateful EJB with CDI) 带有限定符 @Default 的类型 EntityManager 的不满意依赖项 - Unsatisfied dependencies for type EntityManager with qualifiers @Default 带有限定符[@Default]的[PartitionManager]类型的依赖关系未满足? - Unsatisfied dependencies for type [PartitionManager] with qualifiers [@Default]? 带有限定符@Default的XXXX类型的Arquillian不满意的依赖项 - Arquillian Unsatisfied dependencies for type XXXX with qualifiers @Default
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM