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

@@ -24,7 +24,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.integration.config.annotation.AnnotationMetadataAdapter;
/**
* The {@link BeanDefinitionParser} for the {@code <int-http:graph-controller>} component.
@@ -41,11 +41,11 @@ public class IntegrationGraphControllerParser implements BeanDefinitionParser {
public BeanDefinition parse(final Element element, ParserContext parserContext) {
if (HttpContextUtils.WEB_MVC_PRESENT) {
this.graphControllerRegistrar.registerBeanDefinitions(
new StandardAnnotationMetadata(IntegrationGraphControllerParser.class) {
new AnnotationMetadataAdapter() {
@Override
public Map<String, Object> getAnnotationAttributes(String annotationType) {
return Collections.<String, Object>singletonMap("value", element.getAttribute("path"));
return Collections.singletonMap("value", element.getAttribute("path"));
}
}, parserContext.getRegistry());