Examples of BeanDefinitionRegistry


Examples of org.springframework.beans.factory.support.BeanDefinitionRegistry

      if (logger.isInfoEnabled())
        logger.info(beanName + ": " +  beanDefinition.getScope());

      if (beanDefinition.getScope().equals("dynamic") && beanFactory instanceof BeanDefinitionRegistry) {

        final BeanDefinitionRegistry bdr = (BeanDefinitionRegistry) beanFactory;

        final String implBeanName = beanName + "Impl";
        final String targetSourceBeanName = beanName + "TargetSource";

        bdr.registerBeanDefinition(implBeanName, beanDefinition);

        /*
         * <bean id="testInterface"
         * class="org.springframework.aop.framework.ProxyFactoryBean">
         * <property name="targetSource"> <bean
         * class="org.impalaframework.spring.externalconfig.RefreshableTargetSourceFactoryBean">
         * <property name="beanName" methodName = "testInterfaceImpl"/>
         * </bean> </property> </bean>
         */

        RootBeanDefinition targetSource = new RootBeanDefinition(PrototypeTargetSource.class);
        targetSource.getPropertyValues().addPropertyValue("targetBeanName", implBeanName);
        bdr.registerBeanDefinition(targetSourceBeanName, targetSource);

        RootBeanDefinition proxy = new RootBeanDefinition(ProxyFactoryBean.class);
        proxy.getPropertyValues().addPropertyValue("targetSource",
            new RuntimeBeanReference(targetSourceBeanName));
        bdr.registerBeanDefinition(beanName, proxy);

      }
    }
  }
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.