Search in sources :

Example 1 with SmoothieContainer

use of org.hudsonci.inject.SmoothieContainer in project hudson-2.x by hudson.

the class InjectomaticAwareTest method testInjectoAwareWithExtends.

@Test
public void testInjectoAwareWithExtends() {
    SmoothieContainer container = Smoothie.getContainer();
    assertNotNull(container);
    Injectomatic injecto = container.get(Key.get(Injectomatic.class));
    assertNotNull(injecto);
    System.out.println(injecto);
    TestInjectomaticAware aware = container.get(Key.get(TestInjectomaticAware2.class));
    assertNotNull(aware.injecto);
    assertEquals(injecto, aware.injecto);
}
Also used : SmoothieContainer(org.hudsonci.inject.SmoothieContainer) Test(org.junit.Test)

Example 2 with SmoothieContainer

use of org.hudsonci.inject.SmoothieContainer in project hudson-2.x by hudson.

the class SmoothieContainerBootstrap method bootstrap.

public SmoothieContainer bootstrap(final ClassLoader classLoader, final Class... types) {
    log.info("Bootstrapping Smoothie");
    // Build the root space for the given types
    ClassSpace space = new ClassSpaceFactory().create(classLoader, types);
    // Start up the container
    SmoothieContainer container = new SmoothieContainerImpl(new ExtensionModule(space, true));
    Smoothie.setContainer(container);
    // Enable aspect-based injection
    InjectomaticAspectHelper.setEnabled(true);
    return container;
}
Also used : ClassSpace(org.sonatype.guice.bean.reflect.ClassSpace) SmoothieContainer(org.hudsonci.inject.SmoothieContainer) ExtensionModule(org.hudsonci.inject.internal.extension.ExtensionModule)

Aggregations

SmoothieContainer (org.hudsonci.inject.SmoothieContainer)2 ExtensionModule (org.hudsonci.inject.internal.extension.ExtensionModule)1 Test (org.junit.Test)1 ClassSpace (org.sonatype.guice.bean.reflect.ClassSpace)1