当前位置: 首页>>代码示例>>Java>>正文


Java BindingsSpec类代码示例

本文整理汇总了Java中ratpack.guice.BindingsSpec的典型用法代码示例。如果您正苦于以下问题:Java BindingsSpec类的具体用法?Java BindingsSpec怎么用?Java BindingsSpec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BindingsSpec类属于ratpack.guice包,在下文中一共展示了BindingsSpec类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import ratpack.guice.BindingsSpec; //导入依赖的package包/类
@Override
    public void init() {
        try {
            RatpackServer.start(server -> {
                server.serverConfig(c -> {
                    for(Action<ServerConfigBuilder> cfg : getConfigurators()) {
                        c = cfg.with(c);
                    }
                });
                server.registry(Guice.registry(b -> {
                    for(Action<BindingsSpec> binding : getBindings()) {
                        b = binding.with(b);
                    }
                }));
                server.handlers(chain -> {
                    for(Action<Chain> handler : getHandlers()) {
//                        chain = chain.insert(handler);
                        chain = handler.with(chain);
                    }
                });
            });
        } catch (Exception e) {
            logger.error("Ratpack failure", e);
        }
    }
 
开发者ID:beryx,项目名称:text-io,代码行数:26,代码来源:RatpackDataServer.java

示例2: BaseServer

import ratpack.guice.BindingsSpec; //导入依赖的package包/类
public BaseServer(Action<Chain> handlers, ServerConfig config, Action<BindingsSpec> binding) throws ServerException {
    try {
        this.ratpackServer = RatpackServer.of(def ->
                def.serverConfig(config)
                        .registry(Guice.registry(binding))
                        .handlers(handlers));
    } catch (Exception e) {
        throw new ServerException("Error in building ratpack server.", e);
    }
}
 
开发者ID:masgari,项目名称:microservices-sample,代码行数:11,代码来源:BaseServer.java

示例3: build

import ratpack.guice.BindingsSpec; //导入依赖的package包/类
public static EmbeddedApp build(@DelegatesTo(value = Spec.class, strategy = Closure.DELEGATE_FIRST) Closure<?> closure) {

        return new LaunchConfigEmbeddedApp() {
            @Override
            protected LaunchConfig createLaunchConfig() {
                final SpecWrapper spec = new SpecWrapper();
                configureDelegateFirst(spec.getSpec(), closure);
                LaunchConfigBuilder launchConfigBuilder;

                if (spec.baseDirSupplier != null) {
                    Path baseDirPath = spec.baseDirSupplier.get();
                    launchConfigBuilder = LaunchConfigBuilder.baseDir(baseDirPath);
                } else {
                    launchConfigBuilder = LaunchConfigBuilder.noBaseDir();
                }

                configureDelegateFirst(launchConfigBuilder.port(0), spec.launchConfig);

                final Action<? super BindingsSpec> bindingsAction = bindingsSpec -> configureDelegateFirst(new DefaultGroovyBindingsSpec(bindingsSpec), spec.bindings);

                return launchConfigBuilder.build(launchConfig -> {

                    Guice.Builder builder = Guice.builder(launchConfig);
                    if (spec.parentInjector != null) {
                        builder.parent(spec.parentInjector);
                    }

                    return builder.bindings(bindingsAction).build(chain -> Groovy.chain(chain, spec.handlers));
                });
            }
        };
    }
 
开发者ID:jprante,项目名称:elasticsearch-plugin-ratpack,代码行数:33,代码来源:GroovyEmbeddedApp.java

示例4: getBindings

import ratpack.guice.BindingsSpec; //导入依赖的package包/类
public List<Action<BindingsSpec>> getBindings() {
    return bindings;
}
 
开发者ID:beryx,项目名称:text-io,代码行数:4,代码来源:RatpackDataServer.java


注:本文中的ratpack.guice.BindingsSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。