<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Interesting idea (for CDI 1.2 containers running in SE). As you
wrote for CDI 2.0 we need much more.<br>
<br>
<div class="moz-cite-prefix">On 12/19/2014 12:03 PM, Antoine
Sabot-Durand wrote:<br>
</div>
<blockquote
cite="mid:447840BC-5B62-430D-BA64-F66C382F3CC2@sabot-durand.net"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Hi guys,
<div class=""><br class="">
</div>
<div class="">As I said during last meeting I was puzzled by the
non use of CDI and CDIProvider to address CDI boot in Java SE.</div>
<div class=""><br class="">
</div>
<div class="">I just made a small test adding this class to
weld-se :</div>
<div class=""><br class="">
</div>
<div class=""><font class="" face="Menlo">public
class WeldSEProvider extends WeldProvider {<br class="">
<br class="">
private static boolean firstTime = true;<br class="">
<br class="">
@Override<br class="">
public CDI<Object> getCDI() {<br class="">
if (firstTime) {<br class="">
new Weld().initialize();<br class="">
firstTime = false;<br class="">
}<br class="">
<br class="">
return super.getCDI();<br class="">
}<br class="">
<br class="">
}</font><br class="">
</div>
<div class=""><font class="" face="Menlo"><br class="">
</font></div>
<div class="">and replaced the content of
META-INF/services/javax.enterprise.inject.spi.CDIProvider by my
provider</div>
<div class=""><br class="">
</div>
<div class=""><font class="" face="Menlo">org.jboss.weld.environment.se.WeldSEProvider</font></div>
<div class=""><br class="">
</div>
<div class="">Using this new version of Weld-se in my project Iw
as able to boot CDI without implementation classes :</div>
<div class=""><br class="">
</div>
<div class=""><font class="" face="Menlo">public class Main {<br
class="">
<br class="">
public static void main(String[] args) throws Exception {<br
class="">
CDI cdi = CDI.current();<br class="">
BeanManager bm = cdi.getBeanManager();<br class="">
<br class="">
}<br class="">
<br class="">
}</font></div>
<div class=""><font class="" face="Menlo"><br class="">
</font></div>
<div class="">Code is available in my weld fork : <a
moz-do-not-send="true"
href="https://github.com/antoinesd/weld-core/blob/2.2-SE/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldSEProvider.java"
class="">https://github.com/antoinesd/weld-core/blob/2.2-SE/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldSEProvider.java</a></div>
<div class=""><br class="">
</div>
<div class="">Similar CDIProvider can be written for OWB as well.</div>
<div class=""><br class="">
</div>
<div class="">I may have missed something, but I think we can
figure out something like that to provide SE support in CDI
today, even if it’s not as complete as the one we plan to push
in CDI 2.0</div>
<div class=""><br class="">
</div>
<div class="">Antoine</div>
</blockquote>
<br>
</body>
</html>