Examples of AbstractBinder


Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        }

        // SPI/extension hook to configure ResourceConfig
        configure(resourceConfig);

        final AbstractBinder webComponentBinder = new WebComponentBinder(resourceConfig.getProperties());
        resourceConfig.register(webComponentBinder);

        this.appHandler = new ApplicationHandler(resourceConfig, webComponentBinder);

        this.asyncExtensionDelegate = getAsyncExtensionDelegate();
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    public ServiceFinderBinderTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
        locator = Injections.createLocator(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(TestServiceB.class).to(TestContract.class);
                bind(TestServiceD.class).to(TestContract.class);
                new ServiceFinderBinder<TestContract>(TestContract.class, null, RuntimeType.SERVER).bind(this);
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    @Override
    public void configure(final FeatureContext context) {
        final Map<String, Object> properties = context.getConfiguration().getProperties();
        final RuntimeType runtimeType = context.getConfiguration().getRuntimeType();

        context.register(new AbstractBinder() {
            @Override
            protected void configure() {
                // Message Body providers.
                install(new ServiceFinderBinder<MessageBodyReader>(MessageBodyReader.class, properties, runtimeType));
                install(new ServiceFinderBinder<MessageBodyWriter>(MessageBodyWriter.class, properties, runtimeType));
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        register(AppScopedFieldInjectedResource.class);
        register(AppScopedCtorInjectedResource.class);
        register(RequestScopedFieldInjectedResource.class);
        register(RequestScopedCtorInjectedResource.class);

        register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjection("no way CDI would chime in")).to(MyInjection.class);
            }
        });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

class TestUtil {

    public static ResourceConfig registerHK2Services(ResourceConfig rc) {
        rc
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(BuilderHelper.link(HK2ServiceSingleton.class).in(Singleton.class).build());
                    }
                })
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(BuilderHelper.link(HK2ServiceRequestScoped.class).in(RequestScoped.class).build());
                    }
                })
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(BuilderHelper.link(HK2ServicePerLookup.class).in(PerLookup.class).build());
                    }
                });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        final List<Object> providers = Lists.newArrayList(componentBag.getInstances(ComponentBag.EXCLUDE_META_PROVIDERS));

        // Get instances of providers.
        final Set<Class<?>> providerClasses = componentBag.getClasses(ComponentBag.EXCLUDE_META_PROVIDERS);
        if (!providerClasses.isEmpty()) {
            locator = Injections.createLocator(locator, new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(config).to(Configuration.class);
                }
            });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

            }
        }

        if (monitoringEnabled) {
            context.register(ApplicationInfoListener.class);
            context.register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bindFactory(ReferencingFactory.<ApplicationInfo>referenceFactory()).to(
                            new TypeLiteral<Ref<ApplicationInfo>>() {
                            }
                    ).in(Singleton.class);

                    bindFactory(ApplicationInfoInjectionFactory.class).to(
                            ApplicationInfo.class).in(PerLookup.class);
                }
            });
        }

        if (statisticsEnabled) {
            context.register(MonitoringEventListener.class);
            context.register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bindFactory(ReferencingFactory.<MonitoringStatistics>referenceFactory()).to(
                            new TypeLiteral<Ref<MonitoringStatistics>>() {
                            }).in(Singleton.class);
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

        register(AppScopedFieldInjectedResource.class);
        register(AppScopedCtorInjectedResource.class);
        register(RequestScopedFieldInjectedResource.class);
        register(RequestScopedCtorInjectedResource.class);

        register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjection("1st: no way CDI would chime in")).to(MyInjection.class);
                bind(new Hk2InjectedType("2nd: no way CDI would chime in")).to(Hk2InjectedType.class);
            }
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

            this.name = name;
        }

        @Override
        public boolean configure(FeatureContext context) {
            context.register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(new MyInjectedService(name)).to(MyInjectedService.class);
                }
            });
View Full Code Here

Examples of org.glassfish.hk2.utilities.binding.AbstractBinder

    @Test
    public void plainHK2Test() throws Exception {
        final ServiceLocator locator = Injections.createLocator(new RequestScope.Binder(), new JerseyErrorService.Binder(),

                new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bindAsContract(MyInjectablePerRequest.class).in(RequestScoped.class);
                        bindAsContract(MyInjectableSingleton.class).in(Singleton.class);
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.