*/
@Override
public void inject(T instance, CreationalContext<T> ctx) {
injectionTarget.inject(instance, ctx);
for (Field field : annotatedType.getJavaClass().getDeclaredFields()) {
Property annotation = field.getAnnotation(Property.class);
if (annotation != null) {
String key = annotation.value();
String bundleName = annotation.resourceBundleBaseName().length() > 0 ? annotation.resourceBundleBaseName() : ExtensionConfiguration.INSTANCE
.getResourceBundleDefaultBaseName();
if (bundleName == null) {
String errorMessage = "Property bundle name must have a configured default value (see github project instructions) or it must be configured in @"
+ Property.class.getSimpleName() + " annotation.";
logger.error(errorMessage);
throw new PropertyResolverException(errorMessage);
}
field.setAccessible(true);
try {
Object value = propertyResolverBean.resolveProperty(key, bundleName, ctx);
if (logger.isDebugEnabled()) {
logger.debug("Resolved property with key " + key + " to " + value);
}
if (annotation.parameters().length > 0) {
if (field.getType().equals(String.class)) {
value = MessageUtils.formatMessage((String) value, (Object[]) annotation.parameters());
} else {
logger.warn("Found property with defined parameters for formatting but property type is not of type "
+ String.class.getSimpleName() + ". Skipping message format... [" + field.getDeclaringClass().getSimpleName() + "."
+ field.getName() + "]");
}