private WebSphereCDIDeployment createWebSphereCDIDeployment(Application application,
                                                                Set<ExtensionArchive> extensionArchives) throws CDIException {
        WebSphereCDIDeployment webSphereCDIDeployment = new WebSphereCDIDeploymentImpl(application, cdiRuntime);

        DiscoveredBdas discoveredBdas = new DiscoveredBdas(webSphereCDIDeployment);

        if (application.hasModules()) {

            Collection<CDIArchive> libraryArchives = application.getLibraryArchives();
            Collection<CDIArchive> moduleArchives = application.getModuleArchives();

            ClassLoader applicationClassLoader = application.getClassLoader();
            webSphereCDIDeployment.setClassLoader(applicationClassLoader);

            processLibraries(webSphereCDIDeployment,
                             discoveredBdas,
                             libraryArchives);

            processModules(webSphereCDIDeployment,
                           discoveredBdas,
                           moduleArchives);

            //discoveredBdas has the full map, let's go through them all to make sure the wire is complete
            discoveredBdas.makeCrossBoundaryWiring();

            //and finally the runtime extensions
            addRuntimeExtensions(webSphereCDIDeployment,
                                 discoveredBdas);
        }

        return webSphereCDIDeployment;
    }
private WebSphereCDIDeployment createWebSphereCDIDeployment ( Application application , Set < ExtensionArchive > extensionArchives ) throws CDIException { WebSphereCDIDeployment webSphereCDIDeployment = new WebSphereCDIDeploymentImpl ( application , cdiRuntime ) ; DiscoveredBdas discoveredBdas = new DiscoveredBdas ( webSphereCDIDeployment ) ; if ( application . hasModules ( ) ) { Collection < CDIArchive > libraryArchives = application . getLibraryArchives ( ) ; Collection < CDIArchive > moduleArchives = application . getModuleArchives ( ) ; ClassLoader applicationClassLoader = application . getClassLoader ( ) ; webSphereCDIDeployment . setClassLoader ( applicationClassLoader ) ; processLibraries ( webSphereCDIDeployment , discoveredBdas , libraryArchives ) ; processModules ( webSphereCDIDeployment , discoveredBdas , moduleArchives ) ; discoveredBdas . makeCrossBoundaryWiring ( ) ; addRuntimeExtensions ( webSphereCDIDeployment , discoveredBdas ) ; } return webSphereCDIDeployment ; }
This method creates the Deployment structure with all it's BDAs.

@param application
@param extensionArchives
@return
@throws CDIException