Websphere liberty 使用microprofile config api:WELD-001408:类型字符串与限定符@ConfigProperty的未满足依赖关系
我正在使用mpConfig-1.2功能,但在我的设置中它似乎不起作用 使用Liberty 18.0.0.2 在为microprofile config api添加了maven依赖项后,CDI工作正常,但@ConfigProperty在启动时失败,并显示消息Websphere liberty 使用microprofile config api:WELD-001408:类型字符串与限定符@ConfigProperty的未满足依赖关系,websphere-liberty,open-liberty,microprofile,Websphere Liberty,Open Liberty,Microprofile,我正在使用mpConfig-1.2功能,但在我的设置中它似乎不起作用 使用Liberty 18.0.0.2 在为microprofile config api添加了maven依赖项后,CDI工作正常,但@ConfigProperty在启动时失败,并显示消息 [ERROR ] CWWKZ0106E: Could not start web application demo-service-ear {1.0-SNAPSHOT}. [ERROR ] CWWKZ0004E: An excepti
[ERROR ] CWWKZ0106E: Could not start web application demo-service-ear {1.0-SNAPSHOT}.
[ERROR ] CWWKZ0004E: An exception occurred while starting the application demo-service-ear {1.0-SNAPSHOT}. The exception message was: com.ibm.ws.container.service.state.StateChangeException: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type String with qualifiers @ConfigProperty
at injection point [BackedAnnotatedField] @Inject @ConfigProperty private no.klp.bpm.task.KOPSTask.endpoint2
at no.klp.bpm.task.KOPSTask.endpoint2(KOPSTask.java:0)
注释如下所示:
@Inject
@ConfigProperty(name="rule.engine.host", defaultValue="ukjent!")
private String endpoint2;
这里可能有什么问题
/bwa背景信息:
这是一个类加载器可见性问题,主要存在于将较旧的配置(如2017年之前)转入使用微文件的应用程序时。在Liberty中,API分为以下几类:
(例如JavaSE api)api
(例如JavaEE API)spec
(例如IBMAPI
api)com.ibm.websphere.*
(例如来自JPA2.1特性的第三方
API)org.eclipse.persistence.*
api、spec、ibm api
对应用程序可见,这意味着第三方
不可见(因为第三方LIB可能会破坏更改,这将违反Liberty的零迁移策略)
然后,当微文件功能出现时,它们不适合上述任何API类别(不是普遍的标准,不足以被视为spec
,但比第三方
更稳定),因此我们推出了一种新的API类型可见性:
(例如stable
API)org.eclipse.microfile.*
stable
API类型现在默认启用,因此应用程序可以看到这些API
问题说明:
由于您的apiTypeVisibility
硬编码为spec、ibmapi、api、第三方
,这实际上排除了新的stable
api类型,而微文件api被归为该类型。要解决此问题,可以指定:
<classloader apiTypeVisibility="spec, stable, ibm-api, api, third-party"/>
额外资源:
<!-- Read as: In addition to default values, also grant 'third-party' api type visibility -->
<classloader apiTypeVisibility="+third-party"/>