diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/AbstractPulsarAnnotationsBeanPostProcessor.java b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/AbstractPulsarAnnotationsBeanPostProcessor.java index aa364a30..a387b38d 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/AbstractPulsarAnnotationsBeanPostProcessor.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/AbstractPulsarAnnotationsBeanPostProcessor.java @@ -18,7 +18,6 @@ package org.springframework.pulsar.annotation; import java.io.IOException; import java.io.StringReader; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.charset.Charset; @@ -29,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.function.BiFunction; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; @@ -90,8 +88,6 @@ public class AbstractPulsarAnnotationsBeanPostProcessor protected final PulsarHandlerMethodFactoryAdapter messageHandlerMethodFactory = new PulsarHandlerMethodFactoryAdapter(); - protected AnnotationEnhancer enhancer; - @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; @@ -224,24 +220,9 @@ public class AbstractPulsarAnnotationsBeanPostProcessor } } - private void buildEnhancer() { - if (this.applicationContext != null) { - List enhancers = this.applicationContext - .getBeanProvider(AnnotationEnhancer.class, false).orderedStream().toList(); - if (!enhancers.isEmpty()) { - this.enhancer = (attrs, element) -> { - for (AnnotationEnhancer enh : enhancers) { - attrs = enh.apply(attrs, element); - } - return attrs; - }; - } - } - } - @Override public void afterPropertiesSet() { - buildEnhancer(); + // place holder } @Override @@ -427,9 +408,4 @@ public class AbstractPulsarAnnotationsBeanPostProcessor } - protected interface AnnotationEnhancer - extends BiFunction, AnnotatedElement, Map> { - - } - } diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarListenerAnnotationBeanPostProcessor.java b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarListenerAnnotationBeanPostProcessor.java index 31d4f05b..fc40856e 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarListenerAnnotationBeanPostProcessor.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarListenerAnnotationBeanPostProcessor.java @@ -16,7 +16,6 @@ package org.springframework.pulsar.annotation; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -107,8 +106,6 @@ public class PulsarListenerAnnotationBeanPostProcessor extends AbstractPulsar private final ListenerScope listenerScope = new ListenerScope(); - private AnnotationEnhancer enhancer; - private final AtomicInteger counter = new AtomicInteger(); @Override @@ -380,24 +377,15 @@ public class PulsarListenerAnnotationBeanPostProcessor extends AbstractPulsar Set listeners = new HashSet<>(); PulsarListener ann = AnnotatedElementUtils.findMergedAnnotation(method, PulsarListener.class); if (ann != null) { - ann = enhance(method, ann); listeners.add(ann); } PulsarListeners anns = AnnotationUtils.findAnnotation(method, PulsarListeners.class); if (anns != null) { - listeners.addAll(Arrays.stream(anns.value()).map(anno -> enhance(method, anno)).toList()); + listeners.addAll(Arrays.stream(anns.value()).toList()); } return listeners; } - private PulsarListener enhance(AnnotatedElement element, PulsarListener ann) { - if (this.enhancer == null) { - return ann; - } - return AnnotationUtils.synthesizeAnnotation( - this.enhancer.apply(AnnotationUtils.getAnnotationAttributes(ann), element), PulsarListener.class, null); - } - private void addFormatters(FormatterRegistry registry) { this.beanFactory.getBeanProvider(Converter.class).forEach(registry::addConverter); this.beanFactory.getBeanProvider(GenericConverter.class).forEach(registry::addConverter); diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarReaderAnnotationBeanPostProcessor.java b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarReaderAnnotationBeanPostProcessor.java index 5c7bd2d8..91bbb579 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarReaderAnnotationBeanPostProcessor.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/PulsarReaderAnnotationBeanPostProcessor.java @@ -16,7 +16,6 @@ package org.springframework.pulsar.annotation; -import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; @@ -35,7 +34,6 @@ import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.context.ApplicationContext; import org.springframework.core.MethodIntrospector; import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.log.LogAccessor; import org.springframework.lang.Nullable; import org.springframework.pulsar.config.MethodPulsarReaderEndpoint; @@ -250,18 +248,9 @@ public class PulsarReaderAnnotationBeanPostProcessor extends AbstractPulsarAn Set readers = new HashSet<>(); PulsarReader ann = AnnotatedElementUtils.findMergedAnnotation(method, PulsarReader.class); if (ann != null) { - ann = enhance(method, ann); readers.add(ann); } return readers; } - private PulsarReader enhance(AnnotatedElement element, PulsarReader ann) { - if (this.enhancer == null) { - return ann; - } - return AnnotationUtils.synthesizeAnnotation( - this.enhancer.apply(AnnotationUtils.getAnnotationAttributes(ann), element), PulsarReader.class, null); - } - }