Example usage for org.springframework.beans.factory.annotation InjectionMetadata inject

List of usage examples for org.springframework.beans.factory.annotation InjectionMetadata inject

Introduction

In this page you can find the example usage for org.springframework.beans.factory.annotation InjectionMetadata inject.

Prototype

public void inject(Object target, @Nullable String beanName, @Nullable PropertyValues pvs) throws Throwable 

Source Link

Usage

From source file:de.taimos.dvalin.cloud.aws.AWSClientBeanPostProcessor.java

@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
        String beanName) throws BeansException {
    InjectionMetadata metadata = this.buildResourceMetadata(bean.getClass());
    try {//from   www. j a v a2  s .  c o m
        metadata.inject(bean, beanName, pvs);
    } catch (Throwable ex) {
        throw new BeanCreationException(beanName, "Injection of resource dependencies failed", ex);
    }
    return pvs;
}

From source file:com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.java

@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
        String beanName) throws BeanCreationException {

    InjectionMetadata metadata = findReferenceMetadata(beanName, bean.getClass(), pvs);
    try {/*from   w  w  w  . j a  v a2 s.c o m*/
        metadata.inject(bean, beanName, pvs);
    } catch (BeanCreationException ex) {
        throw ex;
    } catch (Throwable ex) {
        throw new BeanCreationException(beanName, "Injection of @Reference dependencies failed", ex);
    }
    return pvs;
}

From source file:net.stickycode.mockwire.spring30.MockwireFieldInjectionAnnotationBeanPostProcessor.java

@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
        String beanName) throws BeansException {

    InjectionMetadata metadata = findAutowiringMetadata(bean.getClass());
    try {// ww  w . jav  a 2s.  c  o  m
        metadata.inject(bean, beanName, pvs);
    } catch (Throwable ex) {
        throw new BeanCreationException(beanName, "Injection of autowired dependencies failed", ex);
    }
    return pvs;
}

From source file:net.stickycode.mockwire.spring30.MockwireFieldInjectionAnnotationBeanPostProcessor.java

/**
 * 'Native' processing method for direct calls with an arbitrary target instance,
 * resolving all of its fields and methods which are annotated with <code>@Autowired</code>.
 * @param bean the target instance to process
 * @throws BeansException if autowiring failed
 */// ww  w  . j  ava2 s  .c  o m
public void processInjection(Object bean) throws BeansException {
    Class<?> clazz = bean.getClass();
    InjectionMetadata metadata = findAutowiringMetadata(clazz);
    try {
        metadata.inject(bean, null, null);
    } catch (Throwable ex) {
        throw new BeanCreationException("Injection of autowired dependencies failed for class [" + clazz + "]",
                ex);
    }
}

From source file:org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.java

@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
        String beanName) throws BeanCreationException {

    InjectionMetadata metadata = findAutowiringMetadata(beanName, bean.getClass(), pvs);
    try {/*  www  . j a v  a  2  s. co m*/
        metadata.inject(bean, beanName, pvs);
    } catch (BeanCreationException ex) {
        throw ex;
    } catch (Throwable ex) {
        throw new BeanCreationException(beanName, "Injection of autowired dependencies failed", ex);
    }
    return pvs;
}

From source file:org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.java

/**
 * 'Native' processing method for direct calls with an arbitrary target instance,
 * resolving all of its fields and methods which are annotated with {@code @Autowired}.
 * @param bean the target instance to process
 * @throws BeanCreationException if autowiring failed
 *//*  ww  w  .j av  a2s  .  c  o m*/
public void processInjection(Object bean) throws BeanCreationException {
    Class<?> clazz = bean.getClass();
    InjectionMetadata metadata = findAutowiringMetadata(clazz.getName(), clazz, null);
    try {
        metadata.inject(bean, null, null);
    } catch (BeanCreationException ex) {
        throw ex;
    } catch (Throwable ex) {
        throw new BeanCreationException("Injection of autowired dependencies failed for class [" + clazz + "]",
                ex);
    }
}