Registration services in the dependency injector
342997
public function registration()
    {
        /**
         * @var Config $settings
         */
        if ($this->getDI() === null) {
            throw new DiNotFoundException("DI can't be found.");
        }

        $creator = new Creator($this->di);

        foreach ($this->services as $name => $settings) {
            $creator->setService($settings);
            $service = $creator->injection();

            if ($service !== null) {
                $call = $settings->get('shared') ? 'setShared' : 'set';
                $this->getDI()->$call($name, $service);
            }
        }
        $this->services = null;
    }
803479
@Override
    public ReferenceContext initializeInjectionServices() throws CDIException {
        Set<Class<?>> injectionClasses = getInjectionClasses();
        ReferenceContext referenceContext = archive.getReferenceContext(injectionClasses);

        return referenceContext;
    }
964717
private function registerServiceProviders()
    {
        $this->app->register( ArboryTranslationServiceProvider::class );
        $this->app->register( TranslatableServiceProvider::class );
        $this->app->register( ArboryFileServiceProvider::class );
        $this->app->register( ArboryAuthServiceProvider::class );
        $this->app->register( GlideImageServiceProvider::class );
        $this->app->register( AssetServiceProvider::class );
        $this->app->register( SettingsServiceProvider::class );
        $this->app->register( ExcelServiceProvider::class );
        $this->app->register( FileManagerServiceProvider::class );
    }
988808
def _register_dependencies(self):
        
        for tree_name, context_entry in context.timetable_context.items():
            tree = self.trees[tree_name]
            assert isinstance(tree, MultiLevelTree)
            for dependent_on in context_entry.dependent_on:
                dependent_on_tree = self.trees[dependent_on]
                assert isinstance(dependent_on_tree, MultiLevelTree)
                tree.register_dependent_on(dependent_on_tree)
1045269
@Override
	public IServiceRegistration registerService(String clazz, Object service,
			Dictionary<String, String> properties) {
		final String sourceMethod = "registerService"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(PlatformServicesImpl.class.getName(), sourceMethod, new Object[]{clazz, service, properties});
		}
		ServiceRegistrationOSGi serviceRegistrationOSGi = null;
		ServiceRegistration<?> serviceRegistration = null;
		BundleContext bundleContext = Activator.getBundleContext();
		if (bundleContext != null) {
			serviceRegistration = bundleContext.registerService(clazz, service,
					properties);
			serviceRegistrationOSGi = new ServiceRegistrationOSGi(serviceRegistration);
		}
		if (isTraceLogging) {
			log.exiting(PlatformServicesImpl.class.getName(), sourceMethod, serviceRegistrationOSGi);
		}
		return serviceRegistrationOSGi;
	}
1059428
public void register(DescribeService service, String describeService) throws POIProxyException {
		serviceManager.registerServiceConfiguration(service.getId(), describeService, service);
	}
200305
private void registerControllerFactories() {
		graphicsService.registerControllerFactory(new ResizeControllerFactory());
		graphicsService.registerControllerFactory(new DragControllerFactory());
		graphicsService.registerControllerFactory(new DeleteControllerFactory());
		graphicsService.registerControllerFactory(new LabelControllerFactory());
		graphicsService.registerControllerFactory(new AnchoredDragControllerFactory());
	}
175696
protected void registerInstrumentationService(BundleContext systemContext) {
        Instrumentation inst = config.getInstrumentation();
        if (inst != null) {
            // Register a wrapper so we can trace callers.
            inst = (Instrumentation) Proxy.newProxyInstance(TraceInstrumentation.class.getClassLoader(),
                                                            new Class[] { Instrumentation.class },
                                                            new TraceInstrumentation(inst));
            Hashtable<String, String> svcProps = new Hashtable<String, String>();
            systemContext.registerService(Instrumentation.class.getName(), inst, svcProps);
        }
    }
191707
private static void bindLogger(InjectorImpl injector) {
    Key<Logger> key = Key.get(Logger.class);
    LoggerFactory loggerFactory = new LoggerFactory();
    injector.state.putBinding(
        key,
        new ProviderInstanceBindingImpl<Logger>(
            injector,
            key,
            SourceProvider.UNKNOWN_SOURCE,
            loggerFactory,
            Scoping.UNSCOPED,
            loggerFactory,
            ImmutableSet.<InjectionPoint>of()));

    try {
      Key<org.slf4j.Logger> slf4jKey = Key.get(org.slf4j.Logger.class);
      SLF4JLoggerFactory slf4jLoggerFactory = new SLF4JLoggerFactory(injector);
      injector.state.putBinding(slf4jKey,
          new ProviderInstanceBindingImpl<org.slf4j.Logger>(injector, slf4jKey,
              SourceProvider.UNKNOWN_SOURCE, slf4jLoggerFactory, Scoping.UNSCOPED,
              slf4jLoggerFactory, ImmutableSet.<InjectionPoint>of()));
    } catch (Throwable e) {}
  }
1232081
protected void registerServant()
    {
        if (ivRemoteObjectWrapper != null)
        {
            // synchronized on the remote Wrapper to set the isRemoteRegistered flag
            synchronized (ivRemoteObjectWrapper)
            {
                if (!isRemoteRegistered)
                {

                    try
                    {
                        if (!isZOS) // LIDB2775-23.9
                        {

                            // Servant registration must be performed with the application classloader
                            // in force.  This is especially needed for JITDeploy since
                            // the JIT pluggin will be on the application classloader.
                            // Without the JIT pluggin the classloader will not trigger
                            // JITDeploy to create the stub.  //d521388
                            Object originalLoader = ThreadContextAccessor.UNCHANGED;
                            try
                            {
                                if (ivBMD != null) // EJBFactories have no BMD d529446
                                {
                                    originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186

                                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                    {
                                        if (originalLoader != ThreadContextAccessor.UNCHANGED)
                                        {
                                            Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
                                            Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
                                        }
                                        else
                                        {
                                            Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
                                        }
                                    }
                                }
                                ivRemoteObjectWrapper.container.getEJBRuntime().registerServant(ivRemoteObjectWrapper.beanId.getByteArray(), ivRemoteObjectWrapper);
                            } finally
                            {
                                EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
                            } // finally

                        } // if( !isZOS )

                        isRemoteRegistered = true;
                    } catch (Exception ex)
                    {
                        FFDCFilter.processException(ex, CLASS_NAME +
                                                        ".registerServant",
                                                    "184", this);
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                        {
                            Tr.event(tc, "Failed to register wrapper instance",
                                     new Object[] { ivRemoteObjectWrapper, ex });
                        }
                    }

                } // if ( !isRemoteRegistered )

            } // synchronized( ivRemoteObject )

        } // if ( ivRemoteObject != null )

    }
1143199
public final void register() {
        synchronized (this) {
            if (filterFactoryServiceRegistration != null) {
                throw new IllegalStateException(String.format("%s [%s] has been registered.", getClass()
                    .getSimpleName(), this));
            }
            filterFactoryServiceRegistration = bundleContext.registerService(SERVICE_CLASSES, this, properties);
            LOGGER.info("Registered filterFactory for application {} with priority {}", getApplicationName(),
                getPriority());
        }
    }
536004
public static void injectWith(InjectionProvider provider) {

		injectionProvider = provider;
		if (injectionProvider != null) {
			log.info("Registered injection provider: " + injectionProvider.getClass().getName());
		}
	}
263668
protected function registerServiceProviders()
	{
		// Core Bus
		// -----------------------------------------------------------------------------
		$this->app->register('Congraph\Core\Bus\BusServiceProvider');

		// Core Event
		// -----------------------------------------------------------------------------
		$this->app->register('Congraph\Core\Events\EventsServiceProvider');

		// Repositories
		// -----------------------------------------------------------------------------
		$this->app->register('Congraph\Core\Repositories\RepositoriesServiceProvider');
	}
607174
protected function registerServiceProviders()
    {
        foreach ($this->serviceProviders[$this->flare->compatibility()] as $class) {
            $this->app->register($class);
        }
    }
498174
@Override
    public void registerService(ServiceInstance<T> service) throws Exception
    {
        Entry<T> newEntry = new Entry<T>(service);
        Entry<T> oldEntry = services.putIfAbsent(service.getId(), newEntry);
        Entry<T> useEntry = (oldEntry != null) ? oldEntry : newEntry;
        synchronized(useEntry)
        {
            if ( useEntry == newEntry ) // i.e. is new
            {
                useEntry.cache = makeNodeCache(service);
            }
            internalRegisterService(service);
        }
    }
1157717
def register_dependency_resolver(scheme, &block)
      self.config = hash_reassoc(config, :dependency_resolvers) do |hash|
        hash.merge(scheme => block)
      end
    end
560018
protected function registerServices()
    {
        $this->app->singleton('modules', function ($app) {
            $path = $app['config']->get('modules.paths.modules');

            return new Repository($app, $path);
        });
    }