diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java index e08f15111..74d29df9b 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java @@ -24,6 +24,7 @@ public class AsyncAnnotationOperationsScanner extends Asyn implements OperationsScanner { private final ClassScanner classScanner; + private final List customizers; public AsyncAnnotationOperationsScanner( AsyncAnnotationProvider asyncAnnotationProvider, @@ -31,7 +32,8 @@ public AsyncAnnotationOperationsScanner( ComponentsService componentsService, PayloadAsyncOperationService payloadAsyncOperationService, List operationBindingProcessors, - List messageBindingProcessors) { + List messageBindingProcessors, + List customizers) { super( asyncAnnotationProvider, payloadAsyncOperationService, @@ -39,6 +41,7 @@ public AsyncAnnotationOperationsScanner( operationBindingProcessors, messageBindingProcessors); this.classScanner = classScanner; + this.customizers = customizers; } @Override @@ -64,7 +67,7 @@ private Map.Entry buildOperation(MethodAndAnnotation metho Operation operation = buildOperation(operationAnnotation, methodAndAnnotation.method(), channelId); operation.setAction(this.asyncAnnotationProvider.getOperationType()); - + customizers.forEach(customizer -> customizer.customize(operation, methodAndAnnotation.method())); return Map.entry(operationId, operation); } } diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java index 554a45d8f..59d526df1 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java @@ -20,6 +20,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Stream; @@ -30,6 +31,8 @@ public class SpringAnnotationClassLevelOperationsScanner< extends ClassLevelAnnotationScanner implements SpringAnnotationOperationsScannerDelegator { + private final List customizers; + public SpringAnnotationClassLevelOperationsScanner( Class classAnnotationClass, Class methodAnnotationClass, @@ -37,7 +40,8 @@ public SpringAnnotationClassLevelOperationsScanner( AsyncHeadersBuilder asyncHeadersBuilder, PayloadMethodService payloadMethodService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List customizers) { super( classAnnotationClass, methodAnnotationClass, @@ -46,6 +50,7 @@ public SpringAnnotationClassLevelOperationsScanner( payloadMethodService, headerClassExtractor, componentsService); + this.customizers = customizers; } @Override @@ -71,6 +76,7 @@ private Stream> mapClassToOperation(Class compon "_", ReferenceUtil.toValidId(channelName), OperationAction.RECEIVE, component.getSimpleName()); Operation operation = buildOperation(classAnnotation, annotatedMethods); + annotatedMethods.forEach(method -> customizers.forEach(customizer -> customizer.customize(operation, method))); return Stream.of(Map.entry(operationId, operation)); } diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfScannerConfiguration.java b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfScannerConfiguration.java index 2d4a60fef..91852a7da 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfScannerConfiguration.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfScannerConfiguration.java @@ -18,6 +18,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.AsyncAnnotationScanner; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadAsyncOperationService; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.AsyncAnnotationOperationsScanner; +import io.github.springwolf.core.asyncapi.scanners.operations.annotations.OperationCustomizer; import io.github.springwolf.core.configuration.docket.AsyncApiDocketService; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -97,14 +98,16 @@ public AsyncAnnotationOperationsScanner asyncListenerAnnotationOp ComponentsService componentsService, PayloadAsyncOperationService payloadService, List operationBindingProcessors, - List messageBindingProcessors) { + List messageBindingProcessors, + List operationCustomizers) { return new AsyncAnnotationOperationsScanner<>( buildAsyncListenerAnnotationProvider(), springwolfClassScanner, componentsService, payloadService, operationBindingProcessors, - messageBindingProcessors); + messageBindingProcessors, + operationCustomizers); } @Bean @@ -141,14 +144,16 @@ public AsyncAnnotationOperationsScanner asyncPublisherOperationA ComponentsService componentsService, PayloadAsyncOperationService payloadService, List operationBindingProcessors, - List messageBindingProcessors) { + List messageBindingProcessors, + List customizers) { return new AsyncAnnotationOperationsScanner<>( buildAsyncPublisherAnnotationProvider(), springwolfClassScanner, componentsService, payloadService, operationBindingProcessors, - messageBindingProcessors); + messageBindingProcessors, + customizers); } private static AsyncAnnotationScanner.AsyncAnnotationProvider diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScannerTest.java index abf1ee1a8..ac409a91b 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScannerTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScannerTest.java @@ -58,6 +58,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; class AsyncAnnotationOperationsScannerTest { @@ -95,6 +96,7 @@ public OperationAction getOperationType() { private final List operationBindingProcessors = List.of(new TestOperationBindingProcessor()); private final List messageBindingProcessors = emptyList(); + private final OperationCustomizer operationCustomizer = mock(OperationCustomizer.class); private final StringValueResolver stringValueResolver = mock(StringValueResolver.class); @@ -105,7 +107,8 @@ public OperationAction getOperationType() { componentsService, payloadAsyncOperationService, operationBindingProcessors, - messageBindingProcessors); + messageBindingProcessors, + List.of(operationCustomizer)); @BeforeEach public void setup() { @@ -336,6 +339,18 @@ void scan_componentHasAsyncMethodAnnotationInAbstractClass() { .containsExactly(Map.entry("abstract-test-channel_send_methodWithAnnotation", expectedOperation)); } + @Test + void operationCustomizerIsCalled() { + // given + setClassToScan(ClassWithListenerAnnotation.class); + + // when + operationsScanner.scan(); + + // then + verify(operationCustomizer).customize(any(), any()); + } + private static class ClassWithoutListenerAnnotation { private void methodWithoutAnnotation() {} diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java index 5a56a17cc..8f824b1d7 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java @@ -23,8 +23,6 @@ import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.NamedSchemaObject; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodService; -import lombok.Data; -import lombok.NoArgsConstructor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,6 +36,7 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; class SpringAnnotationClassLevelOperationsScannerTest { @@ -46,6 +45,7 @@ class SpringAnnotationClassLevelOperationsScannerTest { private final HeaderClassExtractor headerClassExtractor = mock(HeaderClassExtractor.class); private final BindingFactory bindingFactory = mock(BindingFactory.class); private final ComponentsService componentsService = mock(ComponentsService.class); + private final OperationCustomizer operationCustomizer = mock(OperationCustomizer.class); SpringAnnotationClassLevelOperationsScanner scanner = new SpringAnnotationClassLevelOperationsScanner<>( TestClassListener.class, @@ -54,7 +54,8 @@ class SpringAnnotationClassLevelOperationsScannerTest { new AsyncHeadersNotDocumented(), payloadMethodService, headerClassExtractor, - componentsService); + componentsService, + List.of(operationCustomizer)); private static final String CHANNEL_ID = "test-channel-id"; private static final Map defaultOperationBinding = @@ -111,6 +112,15 @@ void scan_componentHasTestListenerMethods() { assertThat(operations).containsExactly(Map.entry(operationName, expectedOperation)); } + @Test + void operationCustomizerIsCalled() { + // when + scanner.scan(ClassWithTestListenerAnnotation.class).toList(); + + // then + verify(operationCustomizer).customize(any(), any()); + } + @TestClassListener private static class ClassWithTestListenerAnnotation { @TestMethodListener @@ -119,13 +129,6 @@ private void methodWithAnnotation(String payload) {} private void methodWithoutAnnotation() {} } - @Data - @NoArgsConstructor - private static class SimpleFoo { - private String s; - private boolean b; - } - @Retention(RetentionPolicy.RUNTIME) @interface TestClassListener {} diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScannerTest.java new file mode 100644 index 000000000..99de113a9 --- /dev/null +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScannerTest.java @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: Apache-2.0 +package io.github.springwolf.core.asyncapi.scanners.operations.annotations; + +import io.github.springwolf.asyncapi.v3.bindings.ChannelBinding; +import io.github.springwolf.asyncapi.v3.bindings.MessageBinding; +import io.github.springwolf.asyncapi.v3.bindings.OperationBinding; +import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPChannelBinding; +import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPMessageBinding; +import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPOperationBinding; +import io.github.springwolf.asyncapi.v3.model.channel.ChannelReference; +import io.github.springwolf.asyncapi.v3.model.channel.message.MessageHeaders; +import io.github.springwolf.asyncapi.v3.model.channel.message.MessageObject; +import io.github.springwolf.asyncapi.v3.model.channel.message.MessagePayload; +import io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference; +import io.github.springwolf.asyncapi.v3.model.operation.Operation; +import io.github.springwolf.asyncapi.v3.model.operation.OperationAction; +import io.github.springwolf.asyncapi.v3.model.schema.MultiFormatSchema; +import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject; +import io.github.springwolf.asyncapi.v3.model.schema.SchemaReference; +import io.github.springwolf.core.asyncapi.components.ComponentsService; +import io.github.springwolf.core.asyncapi.scanners.bindings.BindingFactory; +import io.github.springwolf.core.asyncapi.scanners.common.headers.AsyncHeadersNotDocumented; +import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; +import io.github.springwolf.core.asyncapi.scanners.common.payload.NamedSchemaObject; +import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodParameterService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +class SpringAnnotationMethodLevelOperationsScannerTest { + + private final PayloadMethodParameterService payloadMethodParameterService = mock(); + private final HeaderClassExtractor headerClassExtractor = mock(HeaderClassExtractor.class); + private final BindingFactory bindingFactory = mock(BindingFactory.class); + private final ComponentsService componentsService = mock(ComponentsService.class); + private final OperationCustomizer operationCustomizer = mock(OperationCustomizer.class); + SpringAnnotationMethodLevelOperationsScanner scanner = + new SpringAnnotationMethodLevelOperationsScanner<>( + TestMethodListener.class, + bindingFactory, + new AsyncHeadersNotDocumented(), + List.of(operationCustomizer), + payloadMethodParameterService, + headerClassExtractor, + componentsService); + + private static final String CHANNEL_ID = "test-channel-id"; + private static final Map defaultOperationBinding = + Map.of("protocol", new AMQPOperationBinding()); + private static final Map defaultMessageBinding = + Map.of("protocol", new AMQPMessageBinding()); + private static final Map defaultChannelBinding = + Map.of("protocol", new AMQPChannelBinding()); + + @BeforeEach + void setUp() { + // when + when(bindingFactory.getChannelName(any())).thenReturn(CHANNEL_ID); + + doReturn(defaultOperationBinding).when(bindingFactory).buildOperationBinding(any()); + doReturn(defaultChannelBinding).when(bindingFactory).buildChannelBinding(any()); + doReturn(defaultMessageBinding).when(bindingFactory).buildMessageBinding(any(), any()); + + when(payloadMethodParameterService.extractSchema(any())) + .thenReturn(new NamedSchemaObject(String.class.getName(), new SchemaObject())); + doAnswer(invocation -> AsyncHeadersNotDocumented.NOT_DOCUMENTED.getTitle()) + .when(componentsService) + .registerSchema(any(SchemaObject.class)); + } + + @Test + void scan_componentHasTestListenerMethods() { + // when + List> operations = + scanner.scan(ClassWithTestListenerAnnotation.class).toList(); + + // then + MessagePayload payload = MessagePayload.of(MultiFormatSchema.builder() + .schema(SchemaReference.fromSchema(String.class.getSimpleName())) + .build()); + + MessageObject message = MessageObject.builder() + .messageId(String.class.getName()) + .name(String.class.getName()) + .title(String.class.getSimpleName()) + .payload(payload) + .headers(MessageHeaders.of( + MessageReference.toSchema(AsyncHeadersNotDocumented.NOT_DOCUMENTED.getTitle()))) + .bindings(defaultMessageBinding) + .build(); + + Operation expectedOperation = Operation.builder() + .action(OperationAction.RECEIVE) + .channel(ChannelReference.fromChannel(CHANNEL_ID)) + .messages(List.of(MessageReference.toChannelMessage(CHANNEL_ID, message))) + .bindings(Map.of("protocol", AMQPOperationBinding.builder().build())) + .build(); + String operationName = CHANNEL_ID + "_receive_methodWithAnnotation"; + assertThat(operations).containsExactly(Map.entry(operationName, expectedOperation)); + } + + @Test + void operationCustomizerIsCalled() { + // when + scanner.scan(ClassWithTestListenerAnnotation.class).toList(); + + // then + verify(operationCustomizer).customize(any(), any()); + } + + private static class ClassWithTestListenerAnnotation { + @TestMethodListener + private void methodWithAnnotation(String payload) {} + + private void methodWithoutAnnotation() {} + } + + @Retention(RetentionPolicy.RUNTIME) + @interface TestMethodListener {} +} diff --git a/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java b/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java index 08134983a..fa02891d0 100644 --- a/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java +++ b/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java @@ -10,6 +10,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodParameterService; import io.github.springwolf.core.asyncapi.scanners.operations.SpringAnnotationOperationsScanner; +import io.github.springwolf.core.asyncapi.scanners.operations.annotations.OperationCustomizer; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationClassLevelOperationsScanner; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationMethodLevelOperationsScanner; import io.github.springwolf.plugins.amqp.asyncapi.scanners.bindings.AmqpBindingFactory; @@ -90,7 +91,8 @@ public SpringAnnotationOperationsScanner simpleRabbitClassLevelListenerAnnotatio AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationClassLevelOperationsScanner strategy = new SpringAnnotationClassLevelOperationsScanner<>( RabbitListener.class, @@ -99,7 +101,8 @@ public SpringAnnotationOperationsScanner simpleRabbitClassLevelListenerAnnotatio asyncHeadersForAmqpBuilder, payloadMethodParameterService, headerClassExtractor, - componentsService); + componentsService, + operationCustomizers); return new SpringAnnotationOperationsScanner(springwolfClassScanner, strategy); } @@ -141,13 +144,14 @@ public SpringAnnotationOperationsScanner simpleRabbitMethodLevelListenerAnnotati AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationMethodLevelOperationsScanner strategy = new SpringAnnotationMethodLevelOperationsScanner<>( RabbitListener.class, amqpBindingFactory, asyncHeadersForAmqpBuilder, - List.of(), + operationCustomizers, payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java b/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java index 121020a3a..96f71fe2c 100644 --- a/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java +++ b/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java @@ -10,6 +10,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodParameterService; import io.github.springwolf.core.asyncapi.scanners.operations.SpringAnnotationOperationsScanner; +import io.github.springwolf.core.asyncapi.scanners.operations.annotations.OperationCustomizer; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationMethodLevelOperationsScanner; import io.github.springwolf.plugins.jms.asyncapi.scanners.bindings.JmsBindingFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -63,13 +64,14 @@ public SpringAnnotationOperationsScanner simpleJmsMethodLevelListenerAnnotationO JmsBindingFactory jmsBindingFactory, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationMethodLevelOperationsScanner strategy = new SpringAnnotationMethodLevelOperationsScanner<>( JmsListener.class, jmsBindingFactory, new AsyncHeadersNotDocumented(), - List.of(), + operationCustomizers, payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java b/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java index 902465457..74e52cb5e 100644 --- a/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java +++ b/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java @@ -10,6 +10,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodParameterService; import io.github.springwolf.core.asyncapi.scanners.operations.SpringAnnotationOperationsScanner; +import io.github.springwolf.core.asyncapi.scanners.operations.annotations.OperationCustomizer; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationClassLevelOperationsScanner; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationMethodLevelOperationsScanner; import io.github.springwolf.plugins.kafka.asyncapi.scanners.bindings.KafkaBindingFactory; @@ -87,7 +88,8 @@ public SpringAnnotationOperationsScanner simpleKafkaClassLevelListenerAnnotation AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationClassLevelOperationsScanner strategy = new SpringAnnotationClassLevelOperationsScanner<>( KafkaListener.class, @@ -96,7 +98,8 @@ public SpringAnnotationOperationsScanner simpleKafkaClassLevelListenerAnnotation asyncHeadersForKafkaBuilder, payloadMethodParameterService, headerClassExtractor, - componentsService); + componentsService, + operationCustomizers); return new SpringAnnotationOperationsScanner(springwolfClassScanner, strategy); } @@ -138,13 +141,14 @@ public SpringAnnotationOperationsScanner simpleKafkaMethodLevelListenerAnnotatio AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationMethodLevelOperationsScanner strategy = new SpringAnnotationMethodLevelOperationsScanner<>( KafkaListener.class, kafkaBindingFactory, asyncHeadersForKafkaBuilder, - List.of(), + operationCustomizers, payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java b/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java index 59b0bb473..ca4bc8ed7 100644 --- a/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java +++ b/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java @@ -11,6 +11,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.headers.HeaderClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.PayloadMethodParameterService; import io.github.springwolf.core.asyncapi.scanners.operations.SpringAnnotationOperationsScanner; +import io.github.springwolf.core.asyncapi.scanners.operations.annotations.OperationCustomizer; import io.github.springwolf.core.asyncapi.scanners.operations.annotations.SpringAnnotationMethodLevelOperationsScanner; import io.github.springwolf.plugins.sqs.asyncapi.scanners.bindings.SqsBindingFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -63,13 +64,14 @@ public SpringAnnotationOperationsScanner simpleSqsMethodLevelListenerAnnotationO SqsBindingFactory sqsBindingFactory, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationMethodLevelOperationsScanner strategy = new SpringAnnotationMethodLevelOperationsScanner<>( SqsListener.class, sqsBindingFactory, new AsyncHeadersNotDocumented(), - List.of(), + operationCustomizers, payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-stomp-plugin/src/main/java/io/github/springwolf/plugins/stomp/configuration/SpringwolfStompScannerConfiguration.java b/springwolf-plugins/springwolf-stomp-plugin/src/main/java/io/github/springwolf/plugins/stomp/configuration/SpringwolfStompScannerConfiguration.java index 5a012dcec..19928adab 100644 --- a/springwolf-plugins/springwolf-stomp-plugin/src/main/java/io/github/springwolf/plugins/stomp/configuration/SpringwolfStompScannerConfiguration.java +++ b/springwolf-plugins/springwolf-stomp-plugin/src/main/java/io/github/springwolf/plugins/stomp/configuration/SpringwolfStompScannerConfiguration.java @@ -133,7 +133,8 @@ public SpringAnnotationOperationsScanner simpleStompClassLevelListenerAnnotation AsyncHeadersForStompBuilder asyncHeadersForStompBuilder, PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, - ComponentsService componentsService) { + ComponentsService componentsService, + List operationCustomizers) { SpringAnnotationClassLevelOperationsScanner strategy = new SpringAnnotationClassLevelOperationsScanner<>( MessageMapping.class, @@ -142,7 +143,8 @@ public SpringAnnotationOperationsScanner simpleStompClassLevelListenerAnnotation asyncHeadersForStompBuilder, payloadMethodParameterService, headerClassExtractor, - componentsService); + componentsService, + operationCustomizers); return new SpringAnnotationOperationsScanner(springwolfClassScanner, strategy); }