org.springframework.context.annotation.ScannedGenericBeanDefinition Java Examples

The following examples show how to use org.springframework.context.annotation.ScannedGenericBeanDefinition. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassPathBeanDefinitionScannerAgent.java    From HotswapAgent with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}