/** * Returns a new object graph that includes all of the objects in this graph, * plus additional objects in the {@literal @}{@link Module}-annotated * modules. This graph is a subgraph of the returned graph. * * <p>The current graph is not modified by this operation: its objects and the * dependency links between them are unchanged. But this graph's objects may * be shared by both graphs. For example, the singletons of this graph may be * injected and used by the returned graph. * * <p>This <strong>does not</strong> inject any members or validate the graph. * See {@link #create} for guidance on injection and validation. */ public ObjectGraph plus(Object... modules) { linkEverything(); return makeGraph(this, plugin, modules); }
/** * Returns a new dependency graph using the {@literal @}{@link * Module}-annotated modules. * * <p>This <strong>does not</strong> inject any members. Most applications * should call {@link #injectStatics} to inject static members and {@link * #inject} or get {@link #get(Class)} to inject instance members when this * method has returned. * * <p>This <strong>does not</strong> validate the graph. Rely on build time * tools for graph validation, or call {@link #validate} to find problems in * the graph at runtime. */ public static ObjectGraph create(Object... modules) { RuntimeAggregatingPlugin plugin = new RuntimeAggregatingPlugin( new ClassloadingPlugin(), new ReflectivePlugin()); return makeGraph(null, plugin, modules); }