WildFly 12.0.0.Final + Weld 3.0.3.Final - 如何使用 CDI 2.0?

WildFly 12.0.0.Final + Weld 3.0.3.Final - How to use CDI 2.0?

在 Weld.org 页面上,它说的是 WildFly 12.0。0.Final:

WildFly 12.0.0.Final Weld 3.0.3.Final CDI 1.2 and CDI 2.0 (opt-in via property)

我看不到如何"opt-in via property"?

您需要做的是查看 WildFly 站点,因为您需要 运行 WildFly 在所谓的“EE8 预览”模式下才能启用某些 EE 8 技术(包括 CDI 2.0)。 即 this article 说明了一切:

By default WildFly 12 launches in EE7 mode. In order to use these new capabilities you have to enable EE8 preview mode. This can be accomplished by passing the ee8.preview.mode property during startup:

./standalone.sh -Dee8.preview.mode=true

还有其他选项,例如 CLI 配置或修改独立配置文件。看一眼这篇文章,看看这是如何实现的。