test/src/main/java/de/taimos/dvalin/test/inject/InjectionUtils.java
/**
     * inject the given object into the according field annotated with <em>@Autowired</em><br>
     * additionally the <em>@Qualifier</em> annotation is evaluated to find the correct field
     *
     * @param bean       the bean to inject the dependency into
     * @param qualifier  the qualifier to match if <em>@Qualifier</em> is present on the field
     * @param dependency the object to inject
     */
inject the given object into the according field annotated with @Autowired
additionally the @Qualifier annotation is evaluated to find the correct field

@param bean       the bean to inject the dependency into
@param qualifier  the qualifier to match if @Qualifier is present on the field
@param dependency the object to inject
inject the given object into the according field annotated with @Autowired additionally the @Qualifier annotation is evaluated to find the correct field @param bean the bean to inject the dependency into @param qualifier the qualifier to match if @Qualifier is present on the field @param dependency the object to inject
public static void inject(Object bean, String qualifier, Object dependency) {
        List<Field> fields = getFields(bean.getClass());
        boolean found = false;
        for (Field field : fields) {
            if (field.isAnnotationPresent(Autowired.class) && field.getType().isAssignableFrom(dependency.getClass())) {
                Qualifier qualifierAnnotation = field.getAnnotation(Qualifier.class);
                if ((qualifierAnnotation == null) || qualifierAnnotation.value().equals(qualifier)) {
                    doInjection(bean, dependency, field);
                    found = true;
                }
            }
        }
        if (!found) {
            throw new RuntimeException("Did not find field to inject object of type " + dependency.getClass());
        }
    }
public static void inject ( Object bean , String qualifier , Object dependency ) { List < Field > fields = getFields ( bean . getClass ( ) ) ; boolean found = false ; for ( Field field : fields ) { if ( field . isAnnotationPresent ( Autowired . class ) && field . getType ( ) . isAssignableFrom ( dependency . getClass ( ) ) ) { Qualifier qualifierAnnotation = field . getAnnotation ( Qualifier . class ) ; if ( ( qualifierAnnotation == null ) || qualifierAnnotation . value ( ) . equals ( qualifier ) ) { doInjection ( bean , dependency , field ) ; found = true ; } } } if ( ! found ) { throw new RuntimeException ( "Did not find field to inject object of type " + dependency . getClass ( ) ) ; } }
inject the given object into the according field annotated with <em>@Autowired</em><br>
 additionally the <em>@Qualifier</em> annotation is evaluated to find the correct field
inject the given object into the according field annotated with <em > @Autowired< / em > <br > additionally the <em > @Qualifier< / em > annotation is evaluated to find the correct field