Example usage for org.springframework.beans.factory.config ConfigurableBeanFactory containsLocalBean

List of usage examples for org.springframework.beans.factory.config ConfigurableBeanFactory containsLocalBean

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config ConfigurableBeanFactory containsLocalBean.

Prototype

boolean containsLocalBean(String name);

Source Link

Document

Return whether the local bean factory contains a bean of the given name, ignoring beans defined in ancestor contexts.

Usage

From source file:org.red5.server.plugin.definst.DefinstPlugin.java

@Override
public void doStart() throws Exception {
    super.doStart();

    // add the context to the parent, this will be red5.xml
    ConfigurableBeanFactory factory = ((ConfigurableApplicationContext) context).getBeanFactory();
    // if parent context was not set then lookup red5.common
    log.debug("Lookup common - bean:{} local:{} singleton:{}",
            new Object[] { factory.containsBean("red5.common"), factory.containsLocalBean("red5.common"),
                    factory.containsSingleton("red5.common"), });
    parentContext = (ApplicationContext) factory.getBean("red5.common");

    //create app context
    appContext = new FileSystemXmlApplicationContext(new String[] { "classpath:/definst.xml" }, true,
            parentContext);/*from w w  w .  ja v a  2  s.com*/

    //get a ref to the "default" global scope
    GlobalScope global = (GlobalScope) server.getGlobal("default");

    //create a scope resolver
    ScopeResolver scopeResolver = new ScopeResolver();
    scopeResolver.setGlobalScope(global);

    //create a context - this takes the place of the previous web context
    Context ctx = new Context(appContext, appName);
    ctx.setClientRegistry(new ClientRegistry());
    ctx.setMappingStrategy(new MappingStrategy());
    ctx.setPersistanceStore(global.getStore());
    ctx.setScopeResolver(scopeResolver);
    ctx.setServiceInvoker(new ServiceInvoker());

    //create a handler
    handler = new DefinstHandler();

    //create a scope for the admin
    //      Scope scope = new Scope.Builder((IScope) global, "scope", appName, false).build();
    //      scope.setContext(ctx);
    //      scope.setHandler(handler);

    server.addMapping(hostName, appName, "default");

    //      if (global.addChildScope(scope)) {
    //         log.info("Scope was added to global (default) scope");
    //      } else {
    //         log.warn("Scope was not added to global (default) scope");
    //      }
    //      
    //      //start the scope
    //      scope.start();

}