log.debug("Resolved dependency graph with {} reachable injectables in {}ms", dependencyGraph.getNumberOfInjectables(), System.currentTimeMillis() - start);
final DependencyGraph graph = assertGraphSet(); final InjectionContext injectionContext = assertInjectionContextSet(); final Injectable injectable = graph.getConcreteInjectable(typeName.substring(typeName.lastIndexOf('.')+1)); final InjectableType factoryType = injectable.getInjectableType();
@Test public void doNotMakeDisabledAlternativesAvailableForLookup() throws Exception { addToMetaClassCache( Object.class, DependencyIface.class, DisabledAlternative.class); processor.process(procContext); final DependencyGraph graph = FactoryGenerator.getDependencyGraph(); assertNotNull("The dependency graph was not set.", graph); assertEquals("The dependency graph should not have any injectables.", 0, graph.getNumberOfInjectables()); }
private void bootstrapContainer(final IOCProcessingContext processingContext, final DependencyGraph dependencyGraph, final Set<MetaClass> scopeContextSet, final Statement[] contextLocalVarInvocation, final String contextManagerFieldName) { processingContext.getBlockBuilder() .appendAll(contextLocalVarDeclarations(scopeContextSet)) .append(loadVariable("logger").invoke("debug", "Registering factories with contexts.")) .append(declareVariable("start", long.class, currentTime())) .append(loadVariable("this").invoke("registerFactories", (Object[]) contextLocalVarInvocation)) .append(loadVariable("logger").invoke("debug", "Registered " + dependencyGraph.getNumberOfInjectables() + " factories in {}ms", subtractFromCurrentTime(loadVariable("start")))) .append(loadVariable("logger").invoke("debug", "Adding contexts to context manager...")) .append(loadVariable("start").assignValue(currentTime())); addContextsToContextManager(scopeContextSet, contextManagerFieldName, processingContext.getBlockBuilder()); processingContext.getBlockBuilder() .append(loadVariable("logger").invoke("debug", "Added " + scopeContextSet.size() + " contexts in {}ms", subtractFromCurrentTime(loadVariable("start")))) .append(loadVariable("logger").invoke("debug", "Calling finishInit on " + ContextManager.class.getSimpleName())) .append(loadVariable("start").assignValue(currentTime())); callFinishInitOnContextManager(contextManagerFieldName, processingContext.getBlockBuilder()); processingContext.getBlockBuilder() .append(loadVariable("logger").invoke("debug", "ContextManager#finishInit ran in {}ms", subtractFromCurrentTime(loadVariable("start")))); }