下面列出了怎么用org.springframework.context.annotation.ScannedGenericBeanDefinition的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Resolve bean definition from class definition if applicable.
*
* @param bytes class definition.
* @return the definition or null if not a spring bean
* @throws IOException
*/
public BeanDefinition resolveBeanDefinition(byte[] bytes) throws IOException {
Resource resource = new ByteArrayResource(bytes);
resetCachingMetadataReaderFactoryCache();
MetadataReader metadataReader = getMetadataReaderFactory().getMetadataReader(resource);
if (isCandidateComponent(metadataReader)) {
ScannedGenericBeanDefinition sbd = new ScannedGenericBeanDefinition(metadataReader);
sbd.setResource(resource);
sbd.setSource(resource);
if (isCandidateComponent(sbd)) {
LOGGER.debug("Identified candidate component class '{}'", metadataReader.getClassMetadata().getClassName());
return sbd;
} else {
LOGGER.debug("Ignored because not a concrete top-level class '{}'", metadataReader.getClassMetadata().getClassName());
return null;
}
} else {
LOGGER.trace("Ignored because not matching any filter '{}' ", metadataReader.getClassMetadata().getClassName());
return null;
}
}