Examples of BeanPostProcessor


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

   */
  protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class beanType, String beanName)
      throws BeansException {

    for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext();) {
      BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
      if (beanProcessor instanceof MergedBeanDefinitionPostProcessor) {
        MergedBeanDefinitionPostProcessor bdp = (MergedBeanDefinitionPostProcessor) beanProcessor;
        bdp.postProcessMergedBeanDefinition(mbd, beanType, beanName);
      }
    }
View Full Code Here

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

   */
  protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName)
      throws BeansException {

    for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext();) {
      BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
      if (beanProcessor instanceof InstantiationAwareBeanPostProcessor) {
        InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) beanProcessor;
        Object result = ibp.postProcessBeforeInstantiation(beanClass, beanName);
        if (result != null) {
          return result;
View Full Code Here

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

  protected Constructor[] determineConstructorsFromBeanPostProcessors(Class beanClass, String beanName)
      throws BeansException {

    if (hasInstantiationAwareBeanPostProcessors()) {
      for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext();) {
        BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
        if (beanProcessor instanceof SmartInstantiationAwareBeanPostProcessor) {
          SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) beanProcessor;
          Constructor[] ctors = ibp.determineCandidateConstructors(beanClass, beanName);
          if (ctors != null) {
            return ctors;
View Full Code Here

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

    // to support styles of field injection.
    boolean continueWithPropertyPopulation = true;

    if (!mbd.isSynthetic() && hasInstantiationAwareBeanPostProcessors()) {
      for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext();) {
        BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
        if (beanProcessor instanceof InstantiationAwareBeanPostProcessor) {
          InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) beanProcessor;
          if (!ibp.postProcessAfterInstantiation(bw.getWrappedInstance(), beanName)) {
            continueWithPropertyPopulation = false;
            break;
          }
        }
      }
    }

    if (!continueWithPropertyPopulation) {
      return;
    }

    if (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_BY_NAME ||
        mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_BY_TYPE) {
      MutablePropertyValues newPvs = new MutablePropertyValues(pvs);

      // Add property values based on autowire by name if applicable.
      if (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_BY_NAME) {
        autowireByName(beanName, mbd, bw, newPvs);
      }

      // Add property values based on autowire by type if applicable.
      if (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_BY_TYPE) {
        autowireByType(beanName, mbd, bw, newPvs);
      }

      pvs = newPvs;
    }

    boolean hasInstAwareBpps = hasInstantiationAwareBeanPostProcessors();
    boolean needsDepCheck = (mbd.getDependencyCheck() != RootBeanDefinition.DEPENDENCY_CHECK_NONE);

    if (hasInstAwareBpps || needsDepCheck) {
      PropertyDescriptor[] filteredPds = filterPropertyDescriptorsForDependencyCheck(bw);
      if (hasInstAwareBpps) {
        for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext(); ) {
          BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
          if (beanProcessor instanceof InstantiationAwareBeanPostProcessor) {
            InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) beanProcessor;
            pvs = ibp.postProcessPropertyValues(pvs, filteredPds, bw.getWrappedInstance(), beanName);
            if (pvs == null) {
              return;
View Full Code Here

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

     * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
     */
    private void includeAnnotationProcessors(ConfigurableListableBeanFactory beanFactory) {
       
        // Processor to deal with @Init and @Destroy SCA Annotations
        BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
        beanFactory.addBeanPostProcessor(initDestroyProcessor);

        // Processor to deal with @Reference SCA Annotations
        ComponentStub component = new ComponentStub(implementation.getComponentTie());
        BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
        beanFactory.addBeanPostProcessor(referenceProcessor);
       
        // Processor to deal with @Property SCA Annotations
        PropertyValueStub pvs = new PropertyValueStub(implementation.getPropertyValueTie());
        BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(pvs);
        beanFactory.addBeanPostProcessor(propertyProcessor);
       
        // Processor to deal with @ComponentName SCA Annotations
        BeanPostProcessor componentNameProcessor = new ComponentNameAnnotationProcessor(implementation.getComponentName());
        beanFactory.addBeanPostProcessor(componentNameProcessor);
       
        // Processor to deal with @Constructor SCA Annotations
        BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
        beanFactory.addBeanPostProcessor(constructorProcessor);        
    }
View Full Code Here

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

     */
    public void defineBeanPostProcessors(ConfigurableListableBeanFactory cbf) throws BeansException
    {
        if (!cbf.containsSingleton(POST_PROCESSOR_BEAN_NAME))
        {
            BeanPostProcessor processor = new OrchestraAdvisorBeanPostProcessor(applicationContext);

            // Adding the bean to the singletons set causes it to be picked up by the standard
            // AbstractApplicationContext.RegisterBeanPostProcessors method; that calls
            // getBeanNamesForType(BeanPostProcessor.class, ...) which finds stuff in the
            // singleton map even when there is no actual BeanDefinition for it.
View Full Code Here

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

     */
    public void defineBeanPostProcessors(ConfigurableListableBeanFactory cbf) throws BeansException
    {
        if (!cbf.containsSingleton(POST_PROCESSOR_BEAN_NAME))
        {
            BeanPostProcessor processor = new OrchestraAdvisorBeanPostProcessor(applicationContext);

            // Adding the bean to the singletons set causes it to be picked up by the standard
            // AbstractApplicationContext.RegisterBeanPostProcessors method; that calls
            // getBeanNamesForType(BeanPostProcessor.class, ...) which finds stuff in the
            // singleton map even when there is no actual BeanDefinition for it.
View Full Code Here

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

     */
    public void defineBeanPostProcessors(ConfigurableListableBeanFactory cbf) throws BeansException
    {
        if (!cbf.containsSingleton(POST_PROCESSOR_BEAN_NAME))
        {
            BeanPostProcessor processor = new OrchestraAdvisorBeanPostProcessor(applicationContext);

            // Adding the bean to the singletons set causes it to be picked up by the standard
            // AbstractApplicationContext.RegisterBeanPostProcessors method; that calls
            // getBeanNamesForType(BeanPostProcessor.class, ...) which finds stuff in the
            // singleton map even when there is no actual BeanDefinition for it.
View Full Code Here

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

        SCAParentApplicationContext scaParentContext =
            new SCAParentApplicationContext(component, implementation, proxyService, propertyValueObjectFactory);
        //springContext = new SCAApplicationContext(scaParentContext, implementation.getResource());
       
        XmlBeanFactory beanFactory = new XmlBeanFactory(implementation.getResource());
        BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
        beanFactory.addBeanPostProcessor(initDestroyProcessor);
        BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
        beanFactory.addBeanPostProcessor(referenceProcessor);
        BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(propertyValueObjectFactory, component);
        beanFactory.addBeanPostProcessor(propertyProcessor);
        BeanPostProcessor componentNameProcessor = new ComponentNameAnnotationProcessor(component);
        beanFactory.addBeanPostProcessor(componentNameProcessor);
        BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
        beanFactory.addBeanPostProcessor(constructorProcessor);
        springContext = new GenericApplicationContext(beanFactory, scaParentContext);
       
    } // end constructor
View Full Code Here

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

  public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
      throws BeansException {

    Object result = existingBean;
    for (Iterator it = getBeanPostProcessors().iterator(); it.hasNext();) {
      BeanPostProcessor beanProcessor = (BeanPostProcessor) it.next();
      result = beanProcessor.postProcessBeforeInitialization(result, beanName);
    }
    return result;
  }
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.