Ensure @Component scanned from jar on classpath can be inspected

And test it using a new POF sample.
This commit is contained in:
Dave Syer
2017-06-28 17:11:44 +01:00
parent d1ccef62b5
commit d826884d02
7 changed files with 216 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.type.StandardMethodMetadata;
import org.springframework.core.type.classreading.MethodMetadataReadingVisitor;
import org.springframework.messaging.Message;
@@ -407,7 +407,13 @@ public class ContextFunctionCatalogAutoConfiguration {
.getIntrospectedMethod().getGenericReturnType();
param = extractType(type, paramType, index);
}
else if (source instanceof FileSystemResource) {
else if (source instanceof MethodMetadataReadingVisitor) {
// A component scan with @Beans
MethodMetadataReadingVisitor visitor = (MethodMetadataReadingVisitor) source;
Type type = findBeanType(definition, visitor);
param = extractType(type, paramType, index);
}
else if (source instanceof Resource) {
try {
Class<?> beanType = ClassUtils.forName(definition.getBeanClassName(),
null);
@@ -427,12 +433,6 @@ public class ContextFunctionCatalogAutoConfiguration {
"Cannot instrospect bean: " + definition, e);
}
}
else if (source instanceof MethodMetadataReadingVisitor) {
// A component scan with @Beans
MethodMetadataReadingVisitor visitor = (MethodMetadataReadingVisitor) source;
Type type = findBeanType(definition, visitor);
param = extractType(type, paramType, index);
}
else {
ResolvableType resolvable = (ResolvableType) getField(definition,
"targetType");