tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Owens <ctag+open...@chris-owens.com>
Subject beans.xml and CDI
Date Fri, 02 Aug 2013 01:36:16 GMT
The documentation <http://tomee.apache.org/examples-trunk/cdi-basic/>   says, 

/To use @Inject, the first thing you need is a META-INF/beans.xml file in
the module or jar. This effectively turns on CDI and allows the @Inject
references to work. No META-INF/beans.xml no injection, period. This may
seem overly strict, but it is not without reason. The CDI API is a bit
greedy and does consume a fair about of resources by design./

First, this is ambiguous. META-INF could mean META-INF at the top level in
the WAR file, which is where Tomcat looks for context.xml, for example.  Or
it could mean WEB-INF/classes/META-INF, which is where one puts
persistence.xml. 

Second, when I try putting beans.xml in either of those places, I get this
sort of warning from OpenEJB: 


So I went against what the documentation said and moved beans.xml to WEB-INF
top level.  Now I can't tell whether or not anybody's reading it, since no
reference to it appears in the logs.

So, 

1) Where should beans.xml be, in order to enable CDI
2) What does beans.xml need to have in it.  Can it literally be a
zero-length file?  Or does it need an XML header?




--
View this message in context: http://openejb.979440.n4.nabble.com/beans-xml-and-CDI-tp4664466.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message