|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.context.annotation; |
|
|
|
package org.springframework.context.annotation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.lang.annotation.Annotation; |
|
|
|
import java.lang.annotation.Annotation; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
@ -424,40 +425,38 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC |
|
|
|
if (traceEnabled) { |
|
|
|
if (traceEnabled) { |
|
|
|
logger.trace("Scanning " + resource); |
|
|
|
logger.trace("Scanning " + resource); |
|
|
|
} |
|
|
|
} |
|
|
|
if (resource.isReadable()) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
MetadataReader metadataReader = getMetadataReaderFactory().getMetadataReader(resource); |
|
|
|
MetadataReader metadataReader = getMetadataReaderFactory().getMetadataReader(resource); |
|
|
|
if (isCandidateComponent(metadataReader)) { |
|
|
|
if (isCandidateComponent(metadataReader)) { |
|
|
|
ScannedGenericBeanDefinition sbd = new ScannedGenericBeanDefinition(metadataReader); |
|
|
|
ScannedGenericBeanDefinition sbd = new ScannedGenericBeanDefinition(metadataReader); |
|
|
|
sbd.setSource(resource); |
|
|
|
sbd.setSource(resource); |
|
|
|
if (isCandidateComponent(sbd)) { |
|
|
|
if (isCandidateComponent(sbd)) { |
|
|
|
if (debugEnabled) { |
|
|
|
if (debugEnabled) { |
|
|
|
logger.debug("Identified candidate component class: " + resource); |
|
|
|
logger.debug("Identified candidate component class: " + resource); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
candidates.add(sbd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
if (debugEnabled) { |
|
|
|
|
|
|
|
logger.debug("Ignored because not a concrete top-level class: " + resource); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
candidates.add(sbd); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
if (traceEnabled) { |
|
|
|
if (debugEnabled) { |
|
|
|
logger.trace("Ignored because not matching any filter: " + resource); |
|
|
|
logger.debug("Ignored because not a concrete top-level class: " + resource); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Throwable ex) { |
|
|
|
else { |
|
|
|
throw new BeanDefinitionStoreException( |
|
|
|
if (traceEnabled) { |
|
|
|
"Failed to read candidate component class: " + resource, ex); |
|
|
|
logger.trace("Ignored because not matching any filter: " + resource); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
catch (FileNotFoundException ex) { |
|
|
|
if (traceEnabled) { |
|
|
|
if (traceEnabled) { |
|
|
|
logger.trace("Ignored because not readable: " + resource); |
|
|
|
logger.trace("Ignored non-readable " + resource + ": " + ex.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Throwable ex) { |
|
|
|
|
|
|
|
throw new BeanDefinitionStoreException( |
|
|
|
|
|
|
|
"Failed to read candidate component class: " + resource, ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (IOException ex) { |
|
|
|
catch (IOException ex) { |
|
|
|
|