use of org.sonatype.guice.bean.reflect.ClassSpace 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;
}
use of org.sonatype.guice.bean.reflect.ClassSpace in project pom-manipulation-ext by release-engineering.
the class PlexusTestRunner method createTest.
@Override
protected Object createTest() throws Exception {
final TestClass testClass = getTestClass();
final DefaultContainerConfiguration config = new DefaultContainerConfiguration();
config.setAutoWiring(true);
config.setClassPathScanning(PlexusConstants.SCANNING_ON);
config.setComponentVisibility(PlexusConstants.GLOBAL_VISIBILITY);
config.setName(testClass.getName());
final DefaultPlexusContainer container = new DefaultPlexusContainer(config);
final ClassSpace cs = new URLClassSpace(Thread.currentThread().getContextClassLoader());
container.addPlexusInjector(Arrays.<PlexusBeanModule>asList(new PlexusAnnotatedBeanModule(cs, Collections.emptyMap())));
return container.lookup(testClass.getJavaClass());
}
Aggregations