Package org.glassfish.hk2.utilities.binding

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


            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

    @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

            return Sets.<Class<?>>newHashSet(Resource.class, MyFilter.class, MyWriter.class, MyContainerLifecycleListener.class);
        }

        @Override
        public Set<Object> getSingletons() {
            return Sets.<Object>newHashSet(new AbstractBinder() {
                @Override
                protected void configure() {
                    bindFactory(SingletonFactory.class)
                            .to(SingletonInstance.class)
                            .in(Singleton.class);
View Full Code Here

    }

    @Override
    protected Application configure() {
        final ResourceConfig resourceConfig = new ResourceConfig(TestResource.class);
        resourceConfig.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjectedService("hello")).to(MyInjectedService.class);
            }
        });
View Full Code Here

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

        register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(new MyInjection("1st: unused HK2 binding")).to(MyInjection.class);
                bind(new CdiInjectedType("2nd: unused HK2 binding")).to(CdiInjectedType.class);
            }
View Full Code Here

    @Test
    public void testFeatureInjections() throws Exception {
        config.register(InjectIntoFeatureClass.class)
                .register(new InjectIntoFeatureInstance())
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bind(new InjectMe());
                    }
                });
View Full Code Here

public class SourceProviderTest {
    private ServiceLocator locator;

    @Before
    public void setUp() {
        locator = SaxParserFactoryInjectionProviderTest.createServiceLocator(new AbstractBinder() {
            @Override
            protected void configure() {
                bindAsContract(SourceProvider.SaxSourceReader.class);
            }
        });
View Full Code Here

            // Configure binders and features.
            runtimeCfgState.configureMetaProviders(locator);

            // Bind configuration.
            final AbstractBinder configBinder = new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(runtimeCfgState).to(Configuration.class);
                }
            };
            final DynamicConfiguration dc = Injections.getConfiguration(locator);
            configBinder.bind(dc);
            dc.commit();

            // Bind providers.
            ProviderBinder.bindProviders(runtimeCfgState.getComponentBag(), RuntimeType.CLIENT, null, locator);
View Full Code Here

public class RequestScopeTest extends JerseyTest {

    @Override
    protected Application configure() {
        return new ResourceConfig(RemoveResource.class)
                .register(new AbstractBinder() {
                    @Override
                    protected void configure() {
                        bindFactory(CloseMeFactory.class, RequestScoped.class).to(CloseMe.class).in(RequestScoped.class);
                    }
                });
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.utilities.binding.AbstractBinder

Copyright © 2018 www.massapicom. 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.