Package org.springframework.beans.factory.annotation

Examples of org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor


  /**
   * Actually autowire the target bean after construction/passivation.
   * @param target the target bean to autowire
   */
  protected void doAutowireBean(Object target) {
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    configureBeanPostProcessor(bpp, target);
    bpp.setBeanFactory(getBeanFactory(target));
    bpp.processInjection(target);
  }
View Full Code Here


   */
  @PostConstruct
  @PostActivate
  public void autowireBean(InvocationContext invocationContext) {
    Object target = invocationContext.getTarget();
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    configureBeanPostProcessor(bpp, target);
    bpp.setBeanFactory(getBeanFactory(target));
    bpp.processInjection(target);
  }
View Full Code Here

   */
  public static void processInjectionBasedOnCurrentContext(Object target) {
    Assert.notNull(target, "Target object must not be null");
    WebApplicationContext cc = ContextLoader.getCurrentWebApplicationContext();
    if (cc != null) {
      AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
      bpp.setBeanFactory(cc.getAutowireCapableBeanFactory());
      bpp.processInjection(target);
    }
    else {
      if (logger.isDebugEnabled()) {
        logger.debug("Current WebApplicationContext is not available for processing of " +
            ClassUtils.getShortName(target.getClass()) + ": " +
View Full Code Here

    }


    private void removeInjectCache(BeanFactory beanFactory, String beanName) {

        AutowiredAnnotationBeanPostProcessor autowiredAnnotationBeanPostProcessor =
                beanFactory.getBean(AutowiredAnnotationBeanPostProcessor.class);

        Map<String, InjectionMetadata> injectionMetadataMap =
                (Map<String, InjectionMetadata>) ReflectionUtils.getField(injectionMetadataCacheField, autowiredAnnotationBeanPostProcessor);
View Full Code Here

    }


    private void removeInjectCache(Object controller) {

        AutowiredAnnotationBeanPostProcessor autowiredAnnotationBeanPostProcessor =
                ctx.getBean(AutowiredAnnotationBeanPostProcessor.class);

        Map<String, InjectionMetadata> injectionMetadataMap =
                (Map<String, InjectionMetadata>) ReflectionUtils.getField(injectionMetadataCacheField, autowiredAnnotationBeanPostProcessor);
View Full Code Here

    Assert.notNull(
        appContext,
        "Cannot process bean injection. Reason the specified ApplicationContext is null");
    Assert.notNull(bean,
        "Cannot process bean injection into null bean reference");
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(appContext.getAutowireCapableBeanFactory());
    bpp.processInjection(bean);
  }
View Full Code Here

    Assert.notNull(
        kurentoApplicationContextInternalReference,
        "Cannot process bean injection. Reason Kurento ApplicationContext has not been initialized");
    Assert.notNull(bean,
        "Cannot process bean injection into null bean reference");
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(kurentoApplicationContextInternalReference
        .getAutowireCapableBeanFactory());
    bpp.processInjection(bean);
  }
View Full Code Here

    beanFactory.getBean("bar", TestBean.class);
  }

  @Test
  public void scopedProxyTargetMarkedAsNonAutowireCandidate() {
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(beanFactory);
    beanFactory.addBeanPostProcessor(bpp);
    beanFactory.registerBeanDefinition("config", new RootBeanDefinition(ScopedProxyConfigurationClass.class));
    beanFactory.registerBeanDefinition("consumer", new RootBeanDefinition(ScopedProxyConsumer.class));
    ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
    pp.postProcessBeanFactory(beanFactory);
View Full Code Here

    }
  }

  @Test
  public void genericsBasedInjection() {
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(beanFactory);
    beanFactory.addBeanPostProcessor(bpp);
    RootBeanDefinition bd = new RootBeanDefinition(RepositoryInjectionBean.class);
    bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    beanFactory.registerBeanDefinition("annotatedBean", bd);
    beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(RepositoryConfiguration.class));
View Full Code Here

    assertEquals("Repository<Integer>", bean.integerRepository.toString());
  }

  @Test
  public void genericsBasedInjectionWithScoped() {
    AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
    bpp.setBeanFactory(beanFactory);
    beanFactory.addBeanPostProcessor(bpp);
    RootBeanDefinition bd = new RootBeanDefinition(RepositoryInjectionBean.class);
    bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    beanFactory.registerBeanDefinition("annotatedBean", bd);
    beanFactory.registerBeanDefinition("configClass", new RootBeanDefinition(ScopedRepositoryConfiguration.class));
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor

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.