Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.Scope


        bean = getObjectForBeanInstance(prototypeInstance, name, beanName);
      }

      else {
        String scopeName = mbd.getScope();
        final Scope scope = (Scope) this.scopes.get(scopeName);
        if (scope == null) {
          throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'");
        }
        try {
          Object scopedInstance = scope.get(beanName, new ObjectFactory() {
            public Object getObject() throws BeansException {
              beforePrototypeCreation(beanName);
              try {
                return createBean(beanName, mbd, args);
              }
View Full Code Here


    if (mbd.isSingleton() || mbd.isPrototype()) {
      throw new IllegalArgumentException(
          "Bean name '" + beanName + "' does not correspond to an object in a Scope");
    }
    String scopeName = mbd.getScope();
    Scope scope = (Scope) this.scopes.get(scopeName);
    if (scope == null) {
      throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'");
    }
    Object bean = scope.remove(beanName);
    if (bean != null) {
      destroyBean(beanName, bean, mbd);
    }
  }
View Full Code Here

        registerDisposableBean(beanName,
            new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors()));
      }
      else {
        // A bean with a custom scope...
        Scope scope = (Scope) this.scopes.get(mbd.getScope());
        if (scope == null) {
          throw new IllegalStateException("No Scope registered for scope '" + mbd.getScope() + "'");
        }
        scope.registerDestructionCallback(beanName,
            new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors()));
      }
    }
  }
View Full Code Here

        bean = getObjectForBeanInstance(prototypeInstance, name, beanName, mbd);
      }

      else {
        String scopeName = mbd.getScope();
        final Scope scope = this.scopes.get(scopeName);
        if (scope == null) {
          throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'");
        }
        try {
          Object scopedInstance = scope.get(beanName, new ObjectFactory<Object>() {
            public Object getObject() throws BeansException {
              beforePrototypeCreation(beanName);
              try {
                return createBean(beanName, mbd, args);
              }
View Full Code Here

    if (mbd.isSingleton() || mbd.isPrototype()) {
      throw new IllegalArgumentException(
          "Bean name '" + beanName + "' does not correspond to an object in a mutable scope");
    }
    String scopeName = mbd.getScope();
    Scope scope = this.scopes.get(scopeName);
    if (scope == null) {
      throw new IllegalStateException("No Scope SPI registered for scope '" + scopeName + "'");
    }
    Object bean = scope.remove(beanName);
    if (bean != null) {
      destroyBean(beanName, bean, mbd);
    }
  }
View Full Code Here

   */
  protected Object evaluateBeanDefinitionString(String value, BeanDefinition beanDefinition) {
    if (this.beanExpressionResolver == null) {
      return value;
    }
    Scope scope = (beanDefinition != null ? getRegisteredScope(beanDefinition.getScope()) : null);
    return this.beanExpressionResolver.evaluate(value, new BeanExpressionContext(this, scope));
  }
View Full Code Here

        registerDisposableBean(beanName,
            new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors(), acc));
      }
      else {
        // A bean with a custom scope...
        Scope scope = this.scopes.get(mbd.getScope());
        if (scope == null) {
          throw new IllegalStateException("No Scope registered for scope '" + mbd.getScope() + "'");
        }
        scope.registerDestructionCallback(beanName,
            new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors(), acc));
      }
    }
  }
View Full Code Here

  private void registerPropertyEditors(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addPropertyEditorRegistrar(new OsgiPropertyEditorRegistrar());
  }

  private void cleanOsgiBundleScope(ConfigurableListableBeanFactory beanFactory) {
    Scope scope = beanFactory.getRegisteredScope(OsgiBundleScope.SCOPE_NAME);
    if (scope != null && scope instanceof OsgiBundleScope) {
      if (logger.isDebugEnabled())
        logger.debug("Destroying existing bundle scope beans...");
      ((OsgiBundleScope) scope).destroy();
    }
View Full Code Here

        bean = getObjectForBeanInstance(prototypeInstance, name, beanName, mbd);
      }

      else {
        String scopeName = mbd.getScope();
        final Scope scope = this.scopes.get(scopeName);
        if (scope == null) {
          throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'");
        }
        try {
          Object scopedInstance = scope.get(beanName, new ObjectFactory() {
            public Object getObject() throws BeansException {
              beforePrototypeCreation(beanName);
              try {
                return createBean(beanName, mbd, args);
              }
View Full Code Here

    if (mbd.isSingleton() || mbd.isPrototype()) {
      throw new IllegalArgumentException(
          "Bean name '" + beanName + "' does not correspond to an object in a mutable scope");
    }
    String scopeName = mbd.getScope();
    Scope scope = this.scopes.get(scopeName);
    if (scope == null) {
      throw new IllegalStateException("No Scope SPI registered for scope '" + scopeName + "'");
    }
    Object bean = scope.remove(beanName);
    if (bean != null) {
      destroyBean(beanName, bean, mbd);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.Scope

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.