/**
* Returns the class which is configured in the given {@link PropertyValue}. In case it is not a
* {@link TypedStringValue} or the value contained cannot be interpreted as {@link Class} it will return null.
*
* @param propertyValue
* @param beanName
* @return
*/
private Class<?> getClassForPropertyValue(PropertyValue propertyValue, String beanName) {
Object value = propertyValue.getValue();
String className = null;
if (value instanceof TypedStringValue) {
className = ((TypedStringValue) value).getValue();
} else if (value instanceof String) {
className = (String) value;
} else if (value instanceof Class<?>) {
return (Class<?>) value;
} else {
return Void.class;
}
try {
return ClassUtils.resolveClassName(className, context.getBeanClassLoader());
} catch (IllegalArgumentException ex) {
LOGGER.warn(String.format("Couldn't load class %s referenced as repository interface in bean %s!", className,
beanName));
return Void.class;
}
}
StoreInterfaceAwareBeanPostProcessor.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:spring-content
作者:
评论列表
文章目录