Add AnnotationMetadataAdapter

Since SF has deprecated `StandardAnnotationMetadata` ctors in favor
of factory method, we can't extend it any more to adapt annotation
attributed by the map generated from the XML attributes

* Introduce an `AnnotationMetadataAdapter` to request a
`getAnnotationAttributes()` implementation which is only a method used
in the target `registerBeanDefinitions()` implementations
* Use a new `AnnotationMetadataAdapter` whenever the `StandardAnnotationMetadata`
has been used before
This commit is contained in:
Artem Bilan
2019-05-08 13:25:11 -04:00
committed by Gary Russell
parent 2a16fc54f2
commit bad9677e61
5 changed files with 121 additions and 24 deletions

View File

@@ -30,7 +30,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.config.IntegrationComponentScanRegistrar;
@@ -42,6 +41,7 @@ import org.springframework.util.ClassUtils;
/**
* @author Artem Bilan
* @author Gary Russell
*
* @since 4.0
*/
@RunWith(SpringRunner.class)
@@ -68,8 +68,8 @@ public class EnableComponentScanTests {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
BeanDefinitionRegistry registry) {
super.registerBeanDefinitions(new StandardAnnotationMetadata(
IntegrationComponentScanConfiguration.class, true), registry);
super.registerBeanDefinitions(
AnnotationMetadata.introspect(IntegrationComponentScanConfiguration.class), registry);
}
@Override