本文整理汇总了Java中org.picocontainer.DefaultPicoContainer类的典型用法代码示例。如果您正苦于以下问题:Java DefaultPicoContainer类的具体用法?Java DefaultPicoContainer怎么用?Java DefaultPicoContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultPicoContainer类属于org.picocontainer包,在下文中一共展示了DefaultPicoContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newFactory
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
public static <T> T newFactory(@NotNull final Class<T> clusterClientInterface,
@NotNull final Config clusterConfig,
@NotNull final ActorRegistry actorRegistry) {
requireNonNull(clusterClientInterface);
requireNonNull(clusterConfig);
requireNonNull(actorRegistry);
String factoryClassName = clusterConfig.getString(FACTORY_CLASS);
Config factoryConfig = clusterConfig.getConfig(FACTORY_CONFIG);
MutablePicoContainer container = new DefaultPicoContainer();
container.addComponent(factoryConfig);
container.addComponent(actorRegistry);
try {
Class<? extends T> factoryClass = Class.forName(factoryClassName) // NOSONAR
.asSubclass(clusterClientInterface); // NOSONAR
container.addComponent(factoryClass);
return container.getComponent(factoryClass);
} catch (ClassNotFoundException e) {
throw propagate(e);
}
}
示例2: createReactor
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
/**
* Inject dependencies to create a reactor.
*/
private Reactor<Serializable> createReactor(final ActorKey key, //
final Metrics metrics, //
final Class<? extends Reactor> clazz, //
final ActorClusterClient client, //
final Config config) {
MutablePicoContainer pico = new DefaultPicoContainer();
pico.addComponent(key);
pico.addComponent(config);
pico.addComponent((Sender) (to, payload) -> {
requireNonNull(to);
requireNonNull(payload);
client.actorSender().send(new ActorKey(to), ActorInputMessage.message(key.getName(), payload));
});
pico.addComponent(metrics);
pico.addComponent(clazz);
return pico.getComponent(clazz);
}
示例3: configureContainer
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
public PicoContainer configureContainer(){
pico = new DefaultPicoContainer();
pico.addComponent(StandaloneMigrationLauncher.class);
pico.addComponent(MigrationUtil.class);
pico.start();
return pico;
}
示例4: Plugin
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
public Plugin(final String name, final URL url, final PicoContainer context) throws InvalidPluginException {
MutablePicoContainer container = new DefaultPicoContainer(context);
for (Class<?> clazz : getContributedClasses(url)) {
container.addComponent(clazz);
}
_container = container;
}
示例5: run
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
@Override
public String run() {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/application-context-color-supplier.xml");
SpringPicoContainer springPicoContainer = new SpringPicoContainer(applicationContext);
MutablePicoContainer pico = new DefaultPicoContainer(springPicoContainer);
pico.addComponent(Description.class);
pico.addComponent(LocationSupplier.class);
pico.addComponent(ColoredCarSupplier.class);
pico.addComponent(CarSupplier.class);
Description description = pico.getComponent(Description.class);
return description.getDescription();
}
示例6: handlesUnsatisfiableDependencies
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
@Test
public void handlesUnsatisfiableDependencies() {
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(Application.class);
SpringPicoContainer springPicoContainer = new SpringPicoContainer(applicationContext);
MutablePicoContainer pico = new DefaultPicoContainer(springPicoContainer);
pico.addComponent(B.class);
thrown.expect(AbstractInjector.UnsatisfiableDependenciesException.class);
pico.getComponent(B.class);
}
示例7: run
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
@Override
public String run() {
MutablePicoContainer pico = new DefaultPicoContainer();
pico.addComponent(Description.class);
pico.addComponent(LocationSupplier.class);
pico.addComponent(ColoredCarSupplier.class);
pico.addComponent(ColorSupplier.class);
pico.addComponent(CarSupplier.class);
Description description = pico.getComponent(Description.class);
return description.getDescription();
}
示例8: router
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
private <T extends Controllable> void router(Class<T> controllerClass, PicoContainer appContainer,
Map<String, Object> model, Request request, Response response)
{
MutablePicoContainer requestContainer = new DefaultPicoContainer(appContainer);
ContainerComposer.composeRequest(requestContainer);
try
{
Controllable controller = requestContainer.getComponent(controllerClass);
// TODO: Weave output of before into process and then into after
boolean continue_ = controller.before(request, response);
if (continue_)
{
// Fire the controller's method depending on the HTTP method of the request
String httpMethod = request.requestMethod().toLowerCase();
Method method = controllerClass.getMethod(httpMethod, Request.class, Response.class, Map.class);
Object result = method.invoke(controller, request, response, model);
if (Boolean.TRUE.equals(result))
{
controller.after(request, response);
}
}
}
catch (Exception e)
{
halt(500, "Server Error");
}
}
示例9: usecase_direct_picocontainer
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
@Test
public void usecase_direct_picocontainer() throws Throwable {
MutablePicoContainer pico = new DefaultPicoContainer();
pico.addComponent(RawHttpStepdefs.class);
pico.start();
try {
pico.getComponent(RawHttpStepdefs.class);
fail("Actually all dependencies must be declared within pico");
} catch (Exception e) {
assertThat(e).hasMessageContaining("unsatisfied dependency 'class bdi.glue.http.common.HttpWorld'");
}
}
示例10: createPicoContainer
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
private PicoContainer createPicoContainer() {
MutablePicoContainer container = new DefaultPicoContainer(new Caching().wrap(new ConstructorInjection()));
container.addComponent(TradingService.class);
container.addComponent(TraderSteps.class);
container.addComponent(BeforeAfterSteps.class);
container.addComponent(AndSteps.class);
container.addComponent(CalendarSteps.class);
container.addComponent(PendingSteps.class);
container.addComponent(PriorityMatchingSteps.class);
container.addComponent(SandpitSteps.class);
container.addComponent(SearchSteps.class);
return container;
}
示例11: DefaultPicoContainer
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
private static MutablePicoContainer 初始化容器() {
MutablePicoContainer pico = new DefaultPicoContainer();
pico.addComponent(IocBookStore.class);
pico.addComponent(BookReader.class);
return pico;
}
示例12: makeChildContainer
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
@Override
public MutablePicoContainer makeChildContainer() {
DefaultPicoContainer pc = new ExtendedDefaultPicoContainer(componentFactory, lifecycleStrategy, this, componentMonitor);
addChildContainer(pc);
return pc;
}
示例13: PluginsImpl
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
/**
*/
public PluginsImpl(final PageStore store) {
_store = store;
_context = new DefaultPicoContainer();
_lastSyncedRevision = 0;
}
示例14: Application
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
public Application() throws ConfigurationException
{
appContainer = new DefaultPicoContainer();
ContainerComposer.composeApplication(appContainer);
}
示例15: composeApplication
import org.picocontainer.DefaultPicoContainer; //导入依赖的package包/类
public static void composeApplication(DefaultPicoContainer appContainer)
{
appContainer.addComponent(FooController.class);
appContainer.addComponent(LoginController.class);
}