@ Override public ManagedObjectContext createContext ( ) { Bean < T > bean = null ; EjbDescriptor < T > ejbDescriptor = getEjbDescriptor ( ) ; //in the case of an MDB, the bean should be null, in which case the creational context will be non-contextual if ( ! ejbDescriptor . isMessageDriven ( ) ) { bean = getBean ( ) ; } WeldManager beanManager = getBeanManager ( ) ; WeldCreationalContext < T > creationalContext = beanManager . createCreationalContext ( bean ) ; ManagedObjectContext managedObjectContext = new CDIManagedObjectState ( creationalContext ) ; return managedObjectContext ; }
This version creates a ManagedObjectContext which contains a CreationalContext for an EJB .