gpt4 book ai didi

jakarta-ee - 在 Netbeans 上设置上下文和依赖注入(inject)(在项目创建之后)

转载 作者:行者123 更新时间:2023-12-03 11:21:33 25 4
gpt4 key购买 nike

我正在使用 NetBeans 开发一个 J2EE 项目。
创建项目时,我没有选中“启用上下文和依赖注入(inject)”选项。

项目创建后是否可以更改选项?在哪里?

谢谢!

最佳答案

脚步 -

  • 右键单击您的项目。
  • 转至 New然后选择Others .
  • 来自 Categories列表,选择 Contexts and Dependency Injection .
  • 然后在右侧,来自 File Types列表选择 beans.xml (CDI Configuration File)
  • 单击下一步并完成,将文件名保留为默认值(即 bean)。

  • 就是这样。它创建 beans.xml 文件,它足以告诉 Java EE 兼容服务器您的项目是一个包含 CDI bean 的模块。

    我找到了这个 -

    The 'Enable Contexts and Dependency Injection' option, when selected, generates a beans.xml file in the project's WEB-INF folder when the project template is created. The beans.xml file is used by CDI to instruct the Java EE-compliant server that the project is a module containing CDI beans.



    来自 here .

    关于jakarta-ee - 在 Netbeans 上设置上下文和依赖注入(inject)(在项目创建之后),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7258163/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com