[cdi-dev] Do we already have a kind of CDI SE in 1.1+ ?

Mark Struberg struberg at yahoo.de
Fri Dec 19 17:48:25 EST 2014


This is nowhere near portable as far as I can see.
And we had container specific hacks since day 1 so to say...

Or maybe I don't get it? How would that work in OWB?
Would it even work in older Weld versions (1.2.x)?


LieGrue,
strub



On Friday, 19 December 2014, 12:45, Antoine Sabot-Durand <antoine at sabot-durand.net> wrote:


>
>
>Of course Jozef: We need something more controllable in CDI 2.0. But it can be a basic alternative that works right now in CDI 1.2. 
>
>Antoine Sabot-Durand
>
>Le 19 déc. 2014 à 12:24, Jozef Hartinger <jharting at redhat.com> a écrit :
>
>
>Interesting idea (for CDI 1.2 containers running in SE). As you wrote for CDI 2.0 we need much more.
>
>
>On 12/19/2014 12:03 PM, Antoine Sabot-Durand wrote:
>
>Hi guys, 
>
>
>As I said during last meeting I was puzzled by the non use of CDI and CDIProvider to address CDI boot in Java SE.
>
>
>I just made a small test adding this class to weld-se :
>
>
>public class WeldSEProvider extends WeldProvider {
>
>    private static boolean firstTime = true;
>
>    @Override
>    public CDI<Object> getCDI() {
>        if (firstTime) {
>            new Weld().initialize();
>            firstTime = false;
>        }
>
>        return super.getCDI();
>    }
>
>}
>
>
>
>and replaced the content of META-INF/services/javax.enterprise.inject.spi.CDIProvider by my provider
>
>
>org.jboss.weld.environment.se.WeldSEProvider
>
>
>Using this new version of Weld-se in my project Iw as able to boot CDI without implementation classes :
>
>
>public class Main {
>    
>    public static void main(String[] args) throws Exception {
>        CDI cdi = CDI.current();
>        BeanManager bm = cdi.getBeanManager();
>        
>    }
>    
>}
>
>
>Code is available in my weld fork : https://github.com/antoinesd/weld-core/blob/2.2-SE/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldSEProvider.java
>
>
>Similar CDIProvider can be written for OWB as well.
>
>
>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
>
>
>Antoine
>
>
>_______________________________________________
>cdi-dev mailing list
>cdi-dev at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/cdi-dev
>
>Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>
>



More information about the cdi-dev mailing list