简体   繁体   English

JBoss EAP 6.2 CDI bean.xml

[英]JBoss EAP 6.2 CDI beans.xml

I've got a simple question about getting cdi running in JBoss EAP 6.2 Pojos that are injected with @inject (from javax.annotation) are always null. 我有一个简单的问题,关于如何在JBoss EAP 6.2 Pojo中运行cdi,这些@joject注入(来自javax.annotation)始终为null。

The only thing I can find is that I need to add a beans.xml. 我唯一能找到的就是我需要添加一个beans.xml。 I added that in de META-INF folder of my jar (inside an ear). 我在我的罐子的DE META-INF文件夹中(耳朵内)添加了它。 Still I don't see any cdi/weld logging, so I'm wondering if weld is enabled at all. 我仍然看不到任何cdi / weld日志记录,因此我想知道是否已启用焊接。

We are using a custom standalone.xml and jboss-deployment-structure.xml I tried adding the weld module in those files, but the result is the same: no weld logging and no injected beans. 我们使用的是自定义的standalone.xml和jboss-deployment-structure.xml,我尝试在这些文件中添加焊接模块,但是结果是相同的:没有焊接记录并且没有注入的bean。

I created a sample project with an ejb that is loaded @Startup and tries to inject a pojo. 我用加载了@Startup的ejb创建了一个示例项目,并尝试注入pojo。 When I deploy this project in the same container, the bean initialized, but the injected field is null. 当我在同一容器中部署该项目时,将初始化Bean,但是注入的字段为null。 在此处输入图片说明

I was missing to following in standalone.xml 我错过了在standalone.xml中关注

<extensions>
    <extension module="org.jboss.as.weld"/>
</extensions>

<subsystem xmlns="urn:jboss:domain:weld:1.0"/>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM