Class<?> beanType = m.getParameterTypes()[0];
Object managedBean = findReference(ctx, name, beanType, !nameSupplied);
m.invoke(bean, managedBean);
}
catch (Exception e) {
throw new StripesRuntimeException("Exception while trying to lookup and inject " +
"an SCA Reference into a bean of type " + bean.getClass().getSimpleName() +
" using method " + m.toString(), e);
}
}
// And then inject any properties that are annotated
for (Field f : getFields(bean.getClass())) {
try {
Reference scaReference = f.getAnnotation(Reference.class);
boolean nameSupplied = !"".equals(scaReference.name());
String name = nameSupplied ? scaReference.name() : f.getName();
Object managedBean = findReference(ctx, name, f.getType(), !nameSupplied);
f.set(bean, managedBean);
}
catch (Exception e) {
throw new StripesRuntimeException("Exception while trying to lookup and inject " +
"an SCA Referenceinto a bean of type " + bean.getClass().getSimpleName() +
" using field access on field " + f.toString(), e);
}
}
}