diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AbstractMessageListenerContainerSpec.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AbstractMessageListenerContainerSpec.java index 5e5eb31215..d0df0d5229 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AbstractMessageListenerContainerSpec.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AbstractMessageListenerContainerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -290,7 +290,7 @@ public abstract class AbstractMessageListenerContainerSpec configurer) { + public AmqpInboundChannelAdapterDMLCSpec configureContainer( + Consumer configurer) { + configurer.accept((DirectMessageListenerContainerSpec) this.listenerContainerSpec); return this; } diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpInboundChannelAdapterSMLCSpec.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpInboundChannelAdapterSMLCSpec.java index ae235d4257..17ca1e10e4 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpInboundChannelAdapterSMLCSpec.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpInboundChannelAdapterSMLCSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 the original author or authors. + * Copyright 2017-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,9 @@ public class AmqpInboundChannelAdapterSMLCSpec super(new SimpleMessageListenerContainerSpec(listenerContainer)); } - public AmqpInboundChannelAdapterSMLCSpec configureContainer(Consumer configurer) { + public AmqpInboundChannelAdapterSMLCSpec configureContainer( + Consumer configurer) { + configurer.accept((SimpleMessageListenerContainerSpec) this.listenerContainerSpec); return this; } diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/package-info.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/package-info.java index 2a0be6595e..ba6c7c00c9 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/package-info.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/package-info.java @@ -1,4 +1,5 @@ /** * Provides AMQP Component support for the Java DSL. */ +@org.springframework.lang.NonNullApi package org.springframework.integration.amqp.dsl; diff --git a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/dsl/package-info.java b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/dsl/package-info.java index 2eaba53889..788490080d 100644 --- a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/dsl/package-info.java +++ b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides Apache Cassandra Components support for the Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.cassandra.dsl; diff --git a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandler.java b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandler.java index 3f8059d32e..411aa880f7 100644 --- a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandler.java +++ b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/CassandraMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,7 @@ import org.springframework.integration.expression.ExpressionUtils; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor; import org.springframework.integration.handler.MessageProcessor; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.util.Assert; @@ -75,6 +76,7 @@ public class CassandraMessageHandler extends AbstractReplyProducingMessageHandle /** * Prepared statement to use in association with high throughput ingestion. */ + @Nullable private String ingestQuery; /** diff --git a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/package-info.java b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/package-info.java index 71c8531c65..32acd1b881 100644 --- a/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/package-info.java +++ b/spring-integration-cassandra/src/main/java/org/springframework/integration/cassandra/outbound/package-info.java @@ -1,20 +1,5 @@ -/* - * Copyright 2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /** * Provides classes supporting Cassandra outbound endpoints. */ +@org.springframework.lang.NonNullApi package org.springframework.integration.cassandra.outbound; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/CorrelationStrategyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/CorrelationStrategyFactoryBean.java index 8a3afa28b5..1bf3b757d1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/CorrelationStrategyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/CorrelationStrategyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.springframework.integration.aggregator.CorrelationStrategy; import org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy; import org.springframework.integration.aggregator.MethodInvokingCorrelationStrategy; import org.springframework.integration.util.MessagingAnnotationUtils; +import org.springframework.lang.NonNull; import org.springframework.util.StringUtils; /** @@ -75,6 +76,7 @@ public class CorrelationStrategyFactoryBean implements FactoryBean, } } + @NonNull @Override public ReleaseStrategy getObject() { return this.strategy; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java b/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java index 0b737259b9..10ec021d7e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationObjectSupport.java @@ -98,7 +98,7 @@ public abstract class IntegrationObjectSupport implements BeanNameAware, NamedCo private boolean initialized; @Override - public final void setBeanName(String beanName) { + public final void setBeanName(@Nullable String beanName) { this.beanName = beanName; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/AggregatorSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/AggregatorSpec.java index 34a49460f0..dd9dc221f2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/AggregatorSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/AggregatorSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.springframework.integration.aggregator.ExpressionEvaluatingMessageGro import org.springframework.integration.aggregator.MessageGroupProcessor; import org.springframework.integration.aggregator.MethodInvokingMessageGroupProcessor; import org.springframework.integration.store.MessageGroup; +import org.springframework.lang.Nullable; /** * A {@link CorrelationHandlerSpec} for an {@link AggregatingMessageHandler}. @@ -65,7 +66,7 @@ public class AggregatorSpec extends CorrelationHandlerSpec components) { - if (components != null) { + if (!CollectionUtils.isEmpty(components)) { this.integrationComponents.putAll(components); } return _this(); @@ -223,7 +223,7 @@ public abstract class BaseIntegrationFlowDefinition publishSubscribeChannelConfigurer) { Assert.notNull(publishSubscribeChannelConfigurer, "'publishSubscribeChannelConfigurer' must not be null"); @@ -411,7 +411,7 @@ public abstract class BaseIntegrationFlowDefinition wireTapConfigurer) { + public B wireTap(IntegrationFlow flow, @Nullable Consumer wireTapConfigurer) { MessageChannel wireTapChannel = obtainInputChannelFromFlow(flow); return wireTap(wireTapChannel, wireTapConfigurer); @@ -473,7 +473,7 @@ public abstract class BaseIntegrationFlowDefinition wireTapConfigurer) { + public B wireTap(MessageChannel wireTapChannel, @Nullable Consumer wireTapConfigurer) { WireTapSpec wireTapSpec = new WireTapSpec(wireTapChannel); if (wireTapConfigurer != null) { wireTapConfigurer.accept(wireTapSpec); @@ -528,7 +528,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B controlBus(@Nullable Consumer> endpointConfigurer) { return handle(new ServiceActivatingHandler(new ExpressionCommandMessageProcessor( new ControlBusMethodFilter())), endpointConfigurer); } @@ -553,7 +553,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { Assert.hasText(expression, "'expression' must not be empty"); return transform(null, @@ -580,7 +580,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B transform(Object service, @Nullable String methodName, + @Nullable Consumer> endpointConfigurer) { MethodInvokingTransformer transformer; if (StringUtils.hasText(methodName)) { @@ -676,7 +676,7 @@ public abstract class BaseIntegrationFlowDefinition B transform(Class

expectedType, GenericTransformer genericTransformer) { + public B transform(@Nullable Class

expectedType, GenericTransformer genericTransformer) { return transform(expectedType, genericTransformer, null); } @@ -716,8 +716,8 @@ public abstract class BaseIntegrationFlowDefinition B transform(Class

expectedType, GenericTransformer genericTransformer, - Consumer> endpointConfigurer) { + public B transform(@Nullable Class

expectedType, GenericTransformer genericTransformer, + @Nullable Consumer> endpointConfigurer) { Assert.notNull(genericTransformer, "'genericTransformer' must not be null"); Transformer transformer = genericTransformer instanceof Transformer ? (Transformer) genericTransformer : @@ -750,7 +750,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B filter(String expression, @Nullable Consumer endpointConfigurer) { Assert.hasText(expression, "'expression' must not be empty"); return filter(null, new ExpressionEvaluatingSelector(expression), endpointConfigurer); } @@ -774,7 +774,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B filter(Object service, @Nullable String methodName, + @Nullable Consumer endpointConfigurer) { + MethodInvokingSelector selector = StringUtils.hasText(methodName) ? new MethodInvokingSelector(service, methodName) @@ -826,7 +828,9 @@ public abstract class BaseIntegrationFlowDefinition messageProcessorSpec, Consumer endpointConfigurer) { + public B filter(MessageProcessorSpec messageProcessorSpec, + @Nullable Consumer endpointConfigurer) { + Assert.notNull(messageProcessorSpec, MESSAGE_PROCESSOR_SPEC_MUST_NOT_BE_NULL); MessageProcessor processor = messageProcessorSpec.getObject(); return addComponent(processor) @@ -850,7 +854,7 @@ public abstract class BaseIntegrationFlowDefinition B filter(Class

expectedType, GenericSelector

genericSelector) { + public

B filter(@Nullable Class

expectedType, GenericSelector

genericSelector) { return filter(expectedType, genericSelector, null); } @@ -874,15 +878,15 @@ public abstract class BaseIntegrationFlowDefinition B filter(Class

expectedType, GenericSelector

genericSelector, - Consumer endpointConfigurer) { + public

B filter(@Nullable Class

expectedType, GenericSelector

genericSelector, + @Nullable Consumer endpointConfigurer) { Assert.notNull(genericSelector, "'genericSelector' must not be null"); MessageSelector selector = genericSelector instanceof MessageSelector ? (MessageSelector) genericSelector : (ClassUtils.isLambda(genericSelector.getClass()) ? new MethodInvokingSelector(new LambdaMessageProcessor(genericSelector, expectedType)) : new MethodInvokingSelector(genericSelector, ClassUtils.SELECTOR_ACCEPT_METHOD)); - return this.register(new FilterEndpointSpec(new MessageFilter(selector)), endpointConfigurer); + return register(new FilterEndpointSpec(new MessageFilter(selector)), endpointConfigurer); } /** @@ -926,7 +930,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B handle(String beanName, @Nullable String methodName, + @Nullable Consumer> endpointConfigurer) { + return handle(new ServiceActivatingHandler(new BeanNameMessageProcessor<>(beanName, methodName)), endpointConfigurer); } @@ -966,7 +971,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B handle(Object service, @Nullable String methodName, + @Nullable Consumer> endpointConfigurer) { ServiceActivatingHandler handler; if (StringUtils.hasText(methodName)) { @@ -1011,7 +1016,7 @@ public abstract class BaseIntegrationFlowDefinition B handle(Class

expectedType, GenericHandler

handler) { + public

B handle(@Nullable Class

expectedType, GenericHandler

handler) { return handle(expectedType, handler, null); } @@ -1035,8 +1040,8 @@ public abstract class BaseIntegrationFlowDefinition B handle(Class

expectedType, GenericHandler

handler, - Consumer> endpointConfigurer) { + public

B handle(@Nullable Class

expectedType, GenericHandler

handler, + @Nullable Consumer> endpointConfigurer) { ServiceActivatingHandler serviceActivatingHandler; if (ClassUtils.isLambda(handler.getClass())) { @@ -1108,7 +1113,7 @@ public abstract class BaseIntegrationFlowDefinition B handle(MessageHandlerSpec messageHandlerSpec, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { Assert.notNull(messageHandlerSpec, "'messageHandlerSpec' must not be null"); if (messageHandlerSpec instanceof ComponentsRegistration) { @@ -1132,7 +1137,9 @@ public abstract class BaseIntegrationFlowDefinition the {@link MessageHandler} type. * @return the current {@link BaseIntegrationFlowDefinition}. */ - public B handle(H messageHandler, Consumer> endpointConfigurer) { + public B handle(H messageHandler, + @Nullable Consumer> endpointConfigurer) { + Assert.notNull(messageHandler, "'messageHandler' must not be null"); return register(new GenericEndpointSpec<>(messageHandler), endpointConfigurer); } @@ -1160,7 +1167,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B bridge(@Nullable Consumer> endpointConfigurer) { return handle(new BridgeHandler(), endpointConfigurer); } @@ -1172,7 +1179,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B delay(String groupId, @Nullable Consumer endpointConfigurer) { return register(new DelayerEndpointSpec(new DelayHandler(groupId)), endpointConfigurer); } @@ -1251,7 +1258,7 @@ public abstract class BaseIntegrationFlowDefinition headers, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { return enrichHeaders(headers.get(), endpointConfigurer); } @@ -1279,7 +1286,7 @@ public abstract class BaseIntegrationFlowDefinition headers, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { HeaderEnricherSpec headerEnricherSpec = new HeaderEnricherSpec(); headerEnricherSpec.headers(headers); @@ -1331,7 +1338,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B split(@Nullable Consumer> endpointConfigurer) { return split(new DefaultMessageSplitter(), endpointConfigurer); } @@ -1354,7 +1361,9 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B split(String expression, + @Nullable Consumer> endpointConfigurer) { + Assert.hasText(expression, "'expression' must not be empty"); return split(new ExpressionEvaluatingSplitter(PARSER.parseExpression(expression)), endpointConfigurer); } @@ -1378,7 +1387,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B split(Object service, @Nullable String methodName, + @Nullable Consumer> endpointConfigurer) { MethodInvokingSplitter splitter; if (StringUtils.hasText(methodName)) { @@ -1414,7 +1423,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + public B split(String beanName, @Nullable String methodName, + @Nullable Consumer> endpointConfigurer) { return split(new MethodInvokingSplitter(new BeanNameMessageProcessor<>(beanName, methodName)), endpointConfigurer); @@ -1471,7 +1480,7 @@ public abstract class BaseIntegrationFlowDefinition messageProcessorSpec, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { Assert.notNull(messageProcessorSpec, MESSAGE_PROCESSOR_SPEC_MUST_NOT_BE_NULL); MessageProcessor processor = messageProcessorSpec.getObject(); @@ -1531,8 +1540,8 @@ public abstract class BaseIntegrationFlowDefinition B split(Class

expectedType, Function splitter, - Consumer> endpointConfigurer) { + public

B split(@Nullable Class

expectedType, Function splitter, + @Nullable Consumer> endpointConfigurer) { MethodInvokingSplitter split = ClassUtils.isLambda(splitter.getClass()) @@ -1563,7 +1572,8 @@ public abstract class BaseIntegrationFlowDefinition B split(MessageHandlerSpec splitterMessageHandlerSpec, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { + Assert.notNull(splitterMessageHandlerSpec, "'splitterMessageHandlerSpec' must not be null"); return split(splitterMessageHandlerSpec.getObject(), endpointConfigurer); } @@ -1589,7 +1599,7 @@ public abstract class BaseIntegrationFlowDefinition B split(S splitter, - Consumer> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { Assert.notNull(splitter, "'splitter' must not be null"); return register(new SplitterEndpointSpec<>(splitter), endpointConfigurer); @@ -1627,7 +1637,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { return transform(null, headerFilter, endpointConfigurer); } @@ -1639,7 +1649,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { return transform(null, new ClaimCheckInTransformer(messageStore), endpointConfigurer); } @@ -1692,7 +1702,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { ClaimCheckOutTransformer claimCheckOutTransformer = new ClaimCheckOutTransformer(messageStore); claimCheckOutTransformer.setRemoveMessage(removeMessage); @@ -1727,7 +1737,7 @@ public abstract class BaseIntegrationFlowDefinition resequencer) { + public B resequence(@Nullable Consumer resequencer) { return register(new ResequencerSpec(), resequencer); } @@ -1765,7 +1775,7 @@ public abstract class BaseIntegrationFlowDefinition aggregator) { + public B aggregate(@Nullable Consumer aggregator) { return register(new AggregatorSpec(), aggregator); } @@ -1776,7 +1786,7 @@ public abstract class BaseIntegrationFlowDefinition> routerConfigurer) { + public B route(String beanName, @Nullable String method, + @Nullable Consumer> routerConfigurer) { MethodInvokingRouter methodInvokingRouter = new MethodInvokingRouter(new BeanNameMessageProcessor<>(beanName, method)); @@ -1815,7 +1825,7 @@ public abstract class BaseIntegrationFlowDefinition> routerConfigurer) { + public B route(Object service, @Nullable String methodName, + @Nullable Consumer> routerConfigurer) { MethodInvokingRouter router; if (StringUtils.hasText(methodName)) { @@ -1859,7 +1869,9 @@ public abstract class BaseIntegrationFlowDefinition the target result type. * @return the current {@link BaseIntegrationFlowDefinition}. */ - public B route(String expression, Consumer> routerConfigurer) { + public B route(String expression, + @Nullable Consumer> routerConfigurer) { + return route(new RouterSpec<>(new ExpressionEvaluatingRouter(PARSER.parseExpression(expression))), routerConfigurer); } @@ -1882,7 +1894,7 @@ public abstract class BaseIntegrationFlowDefinition B route(Class expectedType, Function router) { + public B route(@Nullable Class expectedType, Function router) { return route(expectedType, router, null); } @@ -1910,8 +1922,8 @@ public abstract class BaseIntegrationFlowDefinition B route(Class

expectedType, Function router, - Consumer> routerConfigurer) { + public B route(@Nullable Class

expectedType, Function router, + @Nullable Consumer> routerConfigurer) { MethodInvokingRouter methodInvokingRouter = ClassUtils.isLambda(router.getClass()) @@ -1953,7 +1965,7 @@ public abstract class BaseIntegrationFlowDefinition messageProcessorSpec, - Consumer> routerConfigurer) { + @Nullable Consumer> routerConfigurer) { Assert.notNull(messageProcessorSpec, MESSAGE_PROCESSOR_SPEC_MUST_NOT_BE_NULL); MessageProcessor processor = messageProcessorSpec.getObject(); @@ -1963,7 +1975,7 @@ public abstract class BaseIntegrationFlowDefinition> B route(S routerSpec, - Consumer routerConfigurer) { + @Nullable Consumer routerConfigurer) { if (routerConfigurer != null) { routerConfigurer.accept(routerSpec); @@ -1974,7 +1986,7 @@ public abstract class BaseIntegrationFlowDefinition componentsToRegister = null; Map routerComponents = routerSpec.getComponentsToRegister(); - if (routerComponents != null) { + if (!CollectionUtils.isEmpty(routerComponents)) { componentsToRegister = new LinkedHashMap<>(routerComponents); routerComponents.clear(); } @@ -2069,7 +2081,9 @@ public abstract class BaseIntegrationFlowDefinition the {@link AbstractMessageRouter} type. * @return the current {@link BaseIntegrationFlowDefinition}. */ - public B route(R router, Consumer> endpointConfigurer) { + public B route(R router, + @Nullable Consumer> endpointConfigurer) { + return handle(router, endpointConfigurer); } @@ -2098,7 +2112,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B gateway(String requestChannel, @Nullable Consumer endpointConfigurer) { return register(new GatewayEndpointSpec(requestChannel), endpointConfigurer); } @@ -2127,7 +2141,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B gateway(MessageChannel requestChannel, @Nullable Consumer endpointConfigurer) { return register(new GatewayEndpointSpec(requestChannel), endpointConfigurer); } @@ -2162,7 +2176,7 @@ public abstract class BaseIntegrationFlowDefinition endpointConfigurer) { + public B gateway(IntegrationFlow flow, @Nullable Consumer endpointConfigurer) { MessageChannel requestChannel = obtainInputChannelFromFlow(flow); return gateway(requestChannel, endpointConfigurer); } @@ -2217,7 +2231,7 @@ public abstract class BaseIntegrationFlowDefinition gatherer) { + public B scatterGather(MessageChannel scatterChannel, @Nullable Consumer gatherer) { return scatterGather(scatterChannel, gatherer, null); } @@ -2702,8 +2718,8 @@ public abstract class BaseIntegrationFlowDefinition gatherer, - Consumer scatterGather) { + public B scatterGather(MessageChannel scatterChannel, @Nullable Consumer gatherer, + @Nullable Consumer scatterGather) { AggregatorSpec aggregatorSpec = new AggregatorSpec(); if (gatherer != null) { @@ -2790,7 +2806,7 @@ public abstract class BaseIntegrationFlowDefinition barrierConfigurer) { + public B barrier(long timeout, @Nullable Consumer barrierConfigurer) { return register(new BarrierSpec(timeout), barrierConfigurer); } @@ -2811,7 +2827,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { MessageProcessor trigger = new BeanNameMessageProcessor<>(triggerActionId, "trigger"); return handle(new ServiceActivatingHandler(trigger), endpointConfigurer); @@ -2834,7 +2850,7 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { + @Nullable Consumer> endpointConfigurer) { Consumer> trigger = triggerAction::trigger; return handle(new ServiceActivatingHandler(new LambdaMessageProcessor(trigger, Message.class)), @@ -2959,7 +2975,7 @@ public abstract class BaseIntegrationFlowDefinition> B register(S endpointSpec, - Consumer endpointConfigurer) { + @Nullable Consumer endpointConfigurer) { if (endpointConfigurer != null) { endpointConfigurer.accept(endpointSpec); @@ -2977,7 +2993,7 @@ public abstract class BaseIntegrationFlowDefinition, protected final List adviceChain = new LinkedList<>(); // NOSONAR final - protected ConsumerEndpointSpec(H messageHandler) { + protected ConsumerEndpointSpec(@Nullable H messageHandler) { super(messageHandler, new ConsumerEndpointFactoryBean()); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java index ca86c24a06..742c78a5f9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java @@ -28,6 +28,7 @@ import org.springframework.beans.factory.FactoryBean; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.endpoint.AbstractEndpoint; import org.springframework.integration.scheduling.PollerMetadata; +import org.springframework.lang.Nullable; import org.springframework.messaging.MessageChannel; import org.springframework.util.Assert; @@ -54,7 +55,7 @@ public abstract class EndpointSpec, F extends Be protected H handler; // NOSONAR - protected EndpointSpec(H handler, F endpointFactoryBean) { + protected EndpointSpec(@Nullable H handler, F endpointFactoryBean) { this.endpointFactoryBean = endpointFactoryBean; this.handler = handler; } @@ -83,9 +84,7 @@ public abstract class EndpointSpec, F extends Be */ public S poller(PollerSpec pollerMetadataSpec) { Map components = pollerMetadataSpec.getComponentsToRegister(); - if (components != null) { - this.componentsToRegister.putAll(components); - } + this.componentsToRegister.putAll(components); return poller(pollerMetadataSpec.getObject()); } @@ -122,9 +121,7 @@ public abstract class EndpointSpec, F extends Be @Override public Map getComponentsToRegister() { - return this.componentsToRegister.isEmpty() - ? null - : this.componentsToRegister; + return this.componentsToRegister; } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/EnricherSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/EnricherSpec.java index 8bc1d7baf9..7a8ed03808 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/EnricherSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/EnricherSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.integration.transformer.support.AbstractHeaderValueMe import org.springframework.integration.transformer.support.ExpressionEvaluatingHeaderValueMessageProcessor; import org.springframework.integration.transformer.support.HeaderValueMessageProcessor; import org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.util.Assert; @@ -235,7 +236,7 @@ public class EnricherSpec extends ConsumerEndpointSpec EnricherSpec header(String name, V value, Boolean overwrite) { + public EnricherSpec header(String name, V value, @Nullable Boolean overwrite) { AbstractHeaderValueMessageProcessor headerValueMessageProcessor = new StaticHeaderValueMessageProcessor(value); headerValueMessageProcessor.setOverwrite(overwrite); @@ -260,7 +261,7 @@ public class EnricherSpec extends ConsumerEndpointSpec EnricherSpec headerFunction(String name, Function, Object> function, Boolean overwrite) { + public

EnricherSpec headerFunction(String name, Function, Object> function, + @Nullable Boolean overwrite) { + return headerExpression(name, new FunctionExpression<>(function), overwrite); } - private EnricherSpec headerExpression(String name, Expression expression, Boolean overwrite) { + private EnricherSpec headerExpression(String name, Expression expression, @Nullable Boolean overwrite) { AbstractHeaderValueMessageProcessor headerValueMessageProcessor = new ExpressionEvaluatingHeaderValueMessageProcessor<>(expression, null); headerValueMessageProcessor.setOverwrite(overwrite); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/HeaderEnricherSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/HeaderEnricherSpec.java index 1495837514..240286afc8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/HeaderEnricherSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/HeaderEnricherSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ import org.springframework.integration.transformer.support.ExpressionEvaluatingH import org.springframework.integration.transformer.support.HeaderValueMessageProcessor; import org.springframework.integration.transformer.support.RoutingSlipHeaderValueMessageProcessor; import org.springframework.integration.transformer.support.StaticHeaderValueMessageProcessor; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; import org.springframework.util.Assert; @@ -133,7 +134,7 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpecnot overwrite existing headers, unless * {@link #defaultOverwrite(boolean)} is true. * @param headers the header map builder. @@ -146,12 +147,12 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpec headers, Boolean overwrite) { + public HeaderEnricherSpec headers(MapBuilder headers, @Nullable Boolean overwrite) { Assert.notNull(headers, HEADERS_MUST_NOT_BE_NULL); return headers(headers.get(), overwrite); } @@ -159,7 +160,7 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpecnot overwrite existing headers, unless * {@link #defaultOverwrite(boolean)} is true. * @param headers The header builder. @@ -172,12 +173,12 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpec headers, Boolean overwrite) { + public HeaderEnricherSpec headers(Map headers, @Nullable Boolean overwrite) { Assert.notNull(headers, HEADERS_MUST_NOT_BE_NULL); for (Entry entry : headers.entrySet()) { String name = entry.getKey(); @@ -753,7 +754,7 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpec the value type. * @return the header enricher spec. */ - public HeaderEnricherSpec header(String name, V value, Boolean overwrite) { + public HeaderEnricherSpec header(String name, V value, @Nullable Boolean overwrite) { AbstractHeaderValueMessageProcessor headerValueMessageProcessor = new StaticHeaderValueMessageProcessor<>(value); headerValueMessageProcessor.setOverwrite(overwrite); @@ -780,7 +781,7 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpec HeaderEnricherSpec headerFunction(String name, Function, ?> function, - Boolean overwrite) { + @Nullable Boolean overwrite) { return headerExpression(name, new FunctionExpression<>(function), overwrite); } - private HeaderEnricherSpec headerExpression(String name, Expression expression, Boolean overwrite) { + private HeaderEnricherSpec headerExpression(String name, Expression expression, @Nullable Boolean overwrite) { AbstractHeaderValueMessageProcessor headerValueMessageProcessor = new ExpressionEvaluatingHeaderValueMessageProcessor<>(expression, null); headerValueMessageProcessor.setOverwrite(overwrite); @@ -859,7 +860,7 @@ public class HeaderEnricherSpec extends ConsumerEndpointSpec getIntegrationComponents() { - return null; + return Collections.emptyMap(); } /** @@ -214,7 +216,7 @@ public interface IntegrationFlow { * @see SourcePollingChannelAdapterSpec */ static IntegrationFlowBuilder from(MessageSourceSpec> messageSourceSpec, - Consumer endpointConfigurer) { + @Nullable Consumer endpointConfigurer) { Assert.notNull(messageSourceSpec, "'messageSourceSpec' must not be null"); return from(messageSourceSpec.getObject(), endpointConfigurer, registerComponents(messageSourceSpec)); @@ -246,7 +248,7 @@ public interface IntegrationFlow { * @see Supplier */ static IntegrationFlowBuilder fromSupplier(Supplier messageSource, - Consumer endpointConfigurer) { + @Nullable Consumer endpointConfigurer) { Assert.notNull(messageSource, "'messageSource' must not be null"); return from(new AbstractMessageSource<>() { @@ -440,7 +442,7 @@ public interface IntegrationFlow { @SuppressWarnings("overloads") static IntegrationFlowBuilder from(IntegrationFlow other) { Map integrationComponents = other.getIntegrationComponents(); - Assert.notNull(integrationComponents, () -> + Assert.notEmpty(integrationComponents, () -> "The provided integration flow to compose from '" + other + "' must be declared as a bean in the application context"); Object lastIntegrationComponentFromOther = @@ -488,6 +490,7 @@ public interface IntegrationFlow { return integrationFlowBuilder.addComponent(inboundGateway); } + @Nullable private static IntegrationFlowBuilder registerComponents(Object spec) { if (spec instanceof ComponentsRegistration componentsRegistration) { return new IntegrationFlowBuilder() @@ -496,8 +499,9 @@ public interface IntegrationFlow { return null; } + @Nullable @SuppressWarnings("unchecked") - private static T extractProxyTarget(T target) { + private static T extractProxyTarget(@Nullable T target) { if (!(target instanceof Advised advised)) { return target; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java index e9cbbfda14..1b30df054e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ import org.springframework.util.Assert; * Requires the implementation for the {@link #buildFlow()} method to produce * {@link IntegrationFlowDefinition} using one of {@link #from} support methods. *

- * Typically is used for target service implementation: + * Typically, is used for target service implementation: *

  *  @Component
  *  public class MyFlowAdapter extends IntegrationFlowAdapter {
@@ -68,12 +68,12 @@ public abstract class IntegrationFlowAdapter implements IntegrationFlow, Managea
 	@Override
 	public final void configure(IntegrationFlowDefinition flow) {
 		IntegrationFlowDefinition targetFlow = buildFlow();
-		Assert.state(targetFlow != null, "the 'buildFlow()' must not return null");
 		flow.integrationComponents.clear();
 		flow.integrationComponents.putAll(targetFlow.integrationComponents);
 		this.targetIntegrationFlow = flow.get();
 	}
 
+	@Nullable
 	@Override
 	public MessageChannel getInputChannel() {
 		assertTargetIntegrationFlow();
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java
index c1ab2e05a9..de2ce2ca78 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2022 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public abstract class IntegrationFlowDefinition
 	 * {@code
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageProducerSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageProducerSpec.java
index 37baf9fd3a..49217f87a6 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageProducerSpec.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageProducerSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2021 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.integration.dsl;
 
 import org.springframework.integration.endpoint.MessageProducerSupport;
 import org.springframework.integration.support.ErrorMessageStrategy;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 
 /**
@@ -34,7 +35,7 @@ import org.springframework.messaging.MessageChannel;
 public abstract class MessageProducerSpec, P extends MessageProducerSupport>
 		extends IntegrationComponentSpec {
 
-	public MessageProducerSpec(P producer) {
+	public MessageProducerSpec(@Nullable P producer) {
 		this.target = producer;
 	}
 
@@ -43,7 +44,7 @@ public abstract class MessageProducerSpec, P
 	 * Configure the message producer's bean name.
 	 */
 	@Override
-	public S id(String id) {
+	public S id(@Nullable String id) {
 		this.target.setBeanName(id);
 		return super.id(id);
 	}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessagingGatewaySpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessagingGatewaySpec.java
index 90b9996346..23915e3265 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessagingGatewaySpec.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessagingGatewaySpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.integration.dsl;
 import org.springframework.integration.gateway.MessagingGatewaySupport;
 import org.springframework.integration.mapping.InboundMessageMapper;
 import org.springframework.integration.mapping.OutboundMessageMapper;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 
 /**
@@ -34,12 +35,12 @@ import org.springframework.messaging.MessageChannel;
 public abstract class MessagingGatewaySpec, G extends MessagingGatewaySupport>
 		extends IntegrationComponentSpec {
 
-	public MessagingGatewaySpec(G gateway) {
+	public MessagingGatewaySpec(@Nullable G gateway) {
 		this.target = gateway;
 	}
 
 	@Override
-	public S id(String id) {
+	public S id(@Nullable String id) {
 		this.target.setBeanName(id);
 		return super.id(id);
 	}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/RecipientListRouterSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/RecipientListRouterSpec.java
index 4c298d9cd7..2f6246c6ae 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/RecipientListRouterSpec.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/RecipientListRouterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2020 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import org.springframework.integration.filter.ExpressionEvaluatingSelector;
 import org.springframework.integration.filter.MethodInvokingSelector;
 import org.springframework.integration.router.RecipientListRouter;
 import org.springframework.integration.util.ClassUtils;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 import org.springframework.util.StringUtils;
 
@@ -89,7 +90,7 @@ public class RecipientListRouterSpec extends AbstractRouterSpec the selector source type.
@@ -113,7 +114,7 @@ public class RecipientListRouterSpec extends AbstractRouterSpec the selector source type.
@@ -210,7 +211,7 @@ public class RecipientListRouterSpec extends AbstractRouterSpec
-		extends AbstractRouterSpec, R> {
+public class RouterSpec extends AbstractRouterSpec, R> {
 
 	private final RouterMappingProvider mappingProvider;
 
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/SourcePollingChannelAdapterSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/SourcePollingChannelAdapterSpec.java
index 47cb2b4ac8..594cf4641f 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/SourcePollingChannelAdapterSpec.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/SourcePollingChannelAdapterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2021 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.integration.dsl;
 import org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean;
 import org.springframework.integration.core.MessageSource;
 import org.springframework.integration.scheduling.PollerMetadata;
+import org.springframework.lang.Nullable;
 
 /**
  * @author Artem Bilan
@@ -43,7 +44,7 @@ public class SourcePollingChannelAdapterSpec extends
 		return _this();
 	}
 
-	public SourcePollingChannelAdapterSpec poller(PollerMetadata pollerMetadata) {
+	public SourcePollingChannelAdapterSpec poller(@Nullable PollerMetadata pollerMetadata) {
 		if (pollerMetadata != null) {
 			if (PollerMetadata.MAX_MESSAGES_UNBOUNDED == pollerMetadata.getMaxMessagesPerPoll()) {
 				pollerMetadata.setMaxMessagesPerPoll(1);
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java
index 7b1fdb69fe..c99bd4831d 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/StandardIntegrationFlow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2022 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.springframework.beans.factory.BeanNameAware;
 import org.springframework.context.SmartLifecycle;
 import org.springframework.integration.support.context.NamedComponent;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 
 /**
@@ -102,6 +103,7 @@ public class StandardIntegrationFlow
 		throw new UnsupportedOperationException();
 	}
 
+	@Nullable
 	@Override
 	public MessageChannel getInputChannel() {
 		if (this.inputChannel == null) {
@@ -146,8 +148,7 @@ public class StandardIntegrationFlow
 	public void stop(Runnable callback) {
 		AggregatingCallback aggregatingCallback = new AggregatingCallback(this.integrationComponents.size(), callback);
 		for (Object component : this.integrationComponents.keySet()) {
-			if (component instanceof SmartLifecycle) {
-				SmartLifecycle lifecycle = (SmartLifecycle) component;
+			if (component instanceof SmartLifecycle lifecycle) {
 				if (lifecycle.isRunning()) {
 					lifecycle.stop(aggregatingCallback);
 					continue;
@@ -161,8 +162,7 @@ public class StandardIntegrationFlow
 	@Override
 	public void stop() {
 		for (Object component : this.integrationComponents.keySet()) {
-			if (component instanceof SmartLifecycle) {
-				SmartLifecycle lifecycle = (SmartLifecycle) component;
+			if (component instanceof SmartLifecycle lifecycle) {
 				if (lifecycle.isRunning()) {
 					lifecycle.stop();
 				}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java
index 882497063e..51cb0d6287 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/WireTapSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@ public class WireTapSpec extends IntegrationComponentSpec
 			return Collections.singletonMap(this.selector, null);
 		}
 		else {
-			return null;
+			return Collections.emptyMap();
 		}
 	}
 
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowBeanPostProcessor.java
index f180061be4..cf91e734f4 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowBeanPostProcessor.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowBeanPostProcessor.java
@@ -72,6 +72,7 @@ import org.springframework.integration.dsl.StandardIntegrationFlow;
 import org.springframework.integration.dsl.support.MessageChannelReference;
 import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
 import org.springframework.integration.support.context.NamedComponent;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageHandler;
 import org.springframework.util.Assert;
 import org.springframework.util.CollectionUtils;
@@ -178,7 +179,7 @@ public class IntegrationFlowBeanPostProcessor
 				targetIntegrationComponents.put(endpoint, id);
 			}
 			else if (component instanceof MessageChannelReference messageChannelReference) {
-				String channelBeanName = messageChannelReference.getName();
+				String channelBeanName = messageChannelReference.name();
 				if (!this.beanFactory.containsBean(channelBeanName)) {
 					DirectChannel directChannel = new DirectChannel();
 					registerComponent(directChannel, channelBeanName, flowBeanName);
@@ -422,8 +423,7 @@ public class IntegrationFlowBeanPostProcessor
 		}
 
 		return !this.beanFactory.getBeansOfType(instance.getClass(), false, false)
-				.values()
-				.contains(instance);
+				.containsValue(instance);
 	}
 
 	private void registerComponent(Object component, String beanName) {
@@ -431,7 +431,7 @@ public class IntegrationFlowBeanPostProcessor
 	}
 
 	@SuppressWarnings("unchecked")
-	private void registerComponent(Object component, String beanName, String parentName,
+	private void registerComponent(Object component, String beanName, @Nullable String parentName,
 			BeanDefinitionCustomizer... customizers) {
 
 		AbstractBeanDefinition beanDefinition =
@@ -461,7 +461,9 @@ public class IntegrationFlowBeanPostProcessor
 		return generateBeanName(instance, prefix, null, false);
 	}
 
-	private String generateBeanName(Object instance, String prefix, String fallbackId, boolean useFlowIdAsPrefix) {
+	private String generateBeanName(Object instance, String prefix, @Nullable String fallbackId,
+			boolean useFlowIdAsPrefix) {
+
 		if (instance instanceof NamedComponent namedComponent && namedComponent.getBeanName() != null) {
 			String beanName = namedComponent.getBeanName();
 			return useFlowIdAsPrefix
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java
index 9224e53b4a..31ad6c3b12 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018-2021 the original author or authors.
+ * Copyright 2018-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.Map;
 import org.springframework.beans.factory.BeanFactoryAware;
 import org.springframework.integration.core.MessagingTemplate;
 import org.springframework.integration.dsl.IntegrationFlow;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 
 /**
@@ -200,7 +201,7 @@ public interface IntegrationFlowContext {
 		 * @param bean an additional arbitrary bean to register into the application context.
 		 * @return the current builder instance
 		 */
-		IntegrationFlowRegistrationBuilder addBean(String name, Object bean);
+		IntegrationFlowRegistrationBuilder addBean(@Nullable String name, Object bean);
 
 		/**
 		 * Set the configuration source {@code Object} for this manual Integration flow definition.
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowLifecycleAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowLifecycleAdvice.java
index e98fe8dec0..d66d8d3be1 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowLifecycleAdvice.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/IntegrationFlowLifecycleAdvice.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018-2021 the original author or authors.
+ * Copyright 2018-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,11 +16,15 @@
 
 package org.springframework.integration.dsl.context;
 
+import java.util.Map;
+
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
 
 import org.springframework.context.SmartLifecycle;
 import org.springframework.integration.dsl.StandardIntegrationFlow;
+import org.springframework.lang.Nullable;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 
 /**
@@ -77,7 +81,7 @@ class IntegrationFlowLifecycleAdvice implements MethodInterceptor {
 		}
 		else if ("getIntegrationComponents".equals(method)) {
 			result = invocation.proceed();
-			if (result == null) {
+			if (CollectionUtils.isEmpty((Map) result)) {
 				result = this.delegate.getIntegrationComponents();
 			}
 		}
@@ -91,7 +95,8 @@ class IntegrationFlowLifecycleAdvice implements MethodInterceptor {
 		return result;
 	}
 
-	private Object applyToDelegate(MethodInvocation invocation, String method, Object resultArg) {
+	@Nullable
+	private Object applyToDelegate(MethodInvocation invocation, String method, @Nullable Object resultArg) {
 		Object result = resultArg;
 		switch (method) {
 
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
index c760735f11..be0ffc5748 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/StandardIntegrationFlowContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2021 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -242,7 +242,7 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont
 		return Collections.unmodifiableMap(this.registry);
 	}
 
-	private String generateBeanName(Object instance, String parentName) {
+	private String generateBeanName(Object instance, @Nullable String parentName) {
 		if (instance instanceof NamedComponent) {
 			String beanName = ((NamedComponent) instance).getBeanName();
 			if (beanName != null) {
@@ -331,7 +331,7 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont
 		 * @return the current builder instance
 		 */
 		@Override
-		public StandardIntegrationFlowRegistrationBuilder addBean(String name, Object bean) {
+		public StandardIntegrationFlowRegistrationBuilder addBean(@Nullable String name, Object bean) {
 			this.additionalBeans.put(bean, name);
 			return this;
 		}
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/package-info.java
index 22ecaef0c3..6067b368bf 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/package-info.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/context/package-info.java
@@ -1,4 +1,5 @@
 /**
  * The context support classes for Spring Integration Java DSL.
  */
+@org.springframework.lang.NonNullApi
 package org.springframework.integration.dsl.context;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/package-info.java
index bcf137dab3..6d9ccd8569 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/package-info.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/package-info.java
@@ -1,4 +1,5 @@
 /**
  * Root package of the Spring Integration Java DSL.
  */
+@org.springframework.lang.NonNullApi
 package org.springframework.integration.dsl;
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java
index a58f8a8e90..1206d8da3b 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/FixedSubscriberChannelPrototype.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
 
 package org.springframework.integration.dsl.support;
 
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.Message;
 import org.springframework.messaging.MessageChannel;
 
@@ -38,7 +39,7 @@ public class FixedSubscriberChannelPrototype implements MessageChannel {
 		this(null);
 	}
 
-	public FixedSubscriberChannelPrototype(String name) {
+	public FixedSubscriberChannelPrototype(@Nullable String name) {
 		this.name = name;
 	}
 
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java
index e705fba0ab..02c3cef45a 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/MessageChannelReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,24 +25,20 @@ import org.springframework.util.Assert;
  * {@link MessageChannel} bean on the bean registration phase.
  * For internal use only.
  *
+ * @param name the name of the target {@link MessageChannel} bean.
+ *
  * @author Artem Bilan
  *
  * @since 5.0
  *
  * @see org.springframework.integration.dsl.context.IntegrationFlowBeanPostProcessor
  */
-public class MessageChannelReference implements MessageChannel {
+public record MessageChannelReference(String name) implements MessageChannel {
 
-	private final String name;
-
-	public MessageChannelReference(String name) {
+	public MessageChannelReference {
 		Assert.notNull(name, "'name' must not be null");
-		this.name = name;
 	}
 
-	public String getName() {
-		return this.name;
-	}
 
 	@Override
 	public boolean send(Message message) {
diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/package-info.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/package-info.java
index 1affe13084..16ab723fd2 100644
--- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/package-info.java
+++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/support/package-info.java
@@ -1,4 +1,5 @@
 /**
  * Provides various support classes used across Spring Integration Java DSL Components.
  */
+@org.springframework.lang.NonNullApi
 package org.springframework.integration.dsl.support;
diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt
index 517f837c9c..53568f4ff6 100644
--- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt
+++ b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2022 the original author or authors.
+ * Copyright 2020-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -901,6 +901,15 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
 		this.delegate.gateway(requestChannel, Consumer(endpointConfigurer))
 	}
 
+	/**
+	 * Populate the "artificial"
+	 * [org.springframework.integration.gateway.GatewayMessageHandler] for the
+	 * provided `subflow` with options from [GatewayEndpointSpec].
+	 */
+	fun gateway(flow: IntegrationFlow) {
+		this.delegate.gateway(flow)
+	}
+
 	/**
 	 * Populate the "artificial"
 	 * [org.springframework.integration.gateway.GatewayMessageHandler] for the
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java
index e9495c2f2f..0150d87b2d 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flowservices/FlowServiceTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2022 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.jetbrains.annotations.NotNull;
 import org.junit.jupiter.api.Test;
 
 import org.springframework.aop.framework.Advised;
@@ -176,7 +177,7 @@ public class FlowServiceTests {
 		private final AtomicReference resultOverLoggingHandler = new AtomicReference<>();
 
 		@Override
-		public void configure(IntegrationFlowDefinition f) {
+		public void configure(@NotNull IntegrationFlowDefinition f) {
 			f.transform(String::toUpperCase)
 					.log(LoggingHandler.Level.ERROR, m -> {
 						resultOverLoggingHandler.set(m.getPayload());
diff --git a/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/routers/RouterDslTests.kt b/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/routers/RouterDslTests.kt
index 9dcc9f7685..7a1b6d1716 100644
--- a/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/routers/RouterDslTests.kt
+++ b/spring-integration-core/src/test/kotlin/org/springframework/integration/dsl/routers/RouterDslTests.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018-2020 the original author or authors.
+ * Copyright 2018-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -114,8 +114,8 @@ class RouterDslTests {
 				integrationFlow {
 					split()
 					route({ it % 2 == 0 }) {
-						subFlowMapping(true) { gateway(oddFlow().inputChannel) }
-						subFlowMapping(false) { gateway(evenFlow().inputChannel) }
+						subFlowMapping(true) { gateway(oddFlow()) }
+						subFlowMapping(false) { gateway(evenFlow()) }
 					}
 					aggregate()
 				}
diff --git a/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/package-info.java b/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/package-info.java
index 6b922a4896..b2f9816eda 100644
--- a/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/package-info.java
+++ b/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/package-info.java
@@ -1,4 +1,6 @@
 /**
  * Provides Feed Components support for Spring Integration Java DSL.
  */
+@org.springframework.lang.NonNullApi
+@org.springframework.lang.NonNullFields
 package org.springframework.integration.feed.dsl;
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
index 683011f905..35c86db47e 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileTailInboundChannelAdapterFactoryBean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.springframework.integration.JavaUtils;
 import org.springframework.integration.file.tail.ApacheCommonsFileTailingMessageProducer;
 import org.springframework.integration.file.tail.FileTailingMessageProducerSupport;
 import org.springframework.integration.file.tail.OSDelegatingFileTailingMessageProducer;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.MessageChannel;
 import org.springframework.scheduling.TaskScheduler;
 import org.springframework.util.Assert;
@@ -137,7 +138,7 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
 	}
 
 	@Override
-	public void setBeanName(String name) {
+	public void setBeanName(@Nullable String name) {
 		this.beanName = name;
 	}
 
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileInboundChannelAdapterSpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileInboundChannelAdapterSpec.java
index 342297a30f..1d8de28007 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileInboundChannelAdapterSpec.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileInboundChannelAdapterSpec.java
@@ -36,6 +36,7 @@ import org.springframework.integration.file.config.FileListFilterFactoryBean;
 import org.springframework.integration.file.filters.ExpressionFileListFilter;
 import org.springframework.integration.file.filters.FileListFilter;
 import org.springframework.integration.file.locking.NioFileLocker;
+import org.springframework.lang.Nullable;
 import org.springframework.util.Assert;
 
 /**
@@ -51,10 +52,13 @@ public class FileInboundChannelAdapterSpec
 
 	protected final FileListFilterFactoryBean fileListFilterFactoryBean = new FileListFilterFactoryBean(); // NOSONAR
 
+	@Nullable
 	private FileLocker locker;
 
+	@Nullable
 	private ExpressionFileListFilter expressionFileListFilter;
 
+	@Nullable
 	private DirectoryScanner scanner;
 
 	private boolean filtersSet;
@@ -63,7 +67,7 @@ public class FileInboundChannelAdapterSpec
 		this.target = new FileReadingMessageSource();
 	}
 
-	protected FileInboundChannelAdapterSpec(Comparator receptionOrderComparator) {
+	protected FileInboundChannelAdapterSpec(@Nullable Comparator receptionOrderComparator) {
 		this.target = new FileReadingMessageSource(receptionOrderComparator);
 	}
 
@@ -314,7 +318,7 @@ public class FileInboundChannelAdapterSpec
 			return Collections.singletonMap(this.expressionFileListFilter, null);
 		}
 		else {
-			return null;
+			return Collections.emptyMap();
 		}
 	}
 
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileSplitterSpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileSplitterSpec.java
index a7435772c2..4cec1d3d8d 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileSplitterSpec.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/FileSplitterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2020 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.nio.charset.Charset;
 
 import org.springframework.integration.dsl.MessageHandlerSpec;
 import org.springframework.integration.file.splitter.FileSplitter;
+import org.springframework.lang.Nullable;
 import org.springframework.util.StringUtils;
 
 /**
@@ -39,10 +40,12 @@ public class FileSplitterSpec extends MessageHandlerSpec>
 		implements ComponentsRegistration {
 
+	@Nullable
 	private FileNameGenerator fileNameGenerator;
 
+	@Nullable
 	private DefaultFileNameGenerator defaultFileNameGenerator;
 
 	// TODO: should be refactored using generics in next release (breaking change), see PR-3080.
@@ -238,7 +241,7 @@ public abstract class FileTransferringMessageHandlerSpec
 		implements ComponentsRegistration {
 
+	@Nullable
 	private FileNameGenerator fileNameGenerator;
 
+	@Nullable
 	private DefaultFileNameGenerator defaultFileNameGenerator;
 
 	protected FileWritingMessageHandlerSpec(File destinationDirectory) {
@@ -264,7 +267,7 @@ public class FileWritingMessageHandlerSpec
 		if (this.defaultFileNameGenerator != null) {
 			return Collections.singletonMap(this.defaultFileNameGenerator, null);
 		}
-		return null;
+		return Collections.emptyMap();
 	}
 
 }
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/Files.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/Files.java
index cb4d7f2db4..c934d21c83 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/Files.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/Files.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import java.util.function.Function;
 import org.springframework.expression.Expression;
 import org.springframework.integration.file.transformer.FileToByteArrayTransformer;
 import org.springframework.integration.file.transformer.FileToStringTransformer;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.Message;
 
 /**
@@ -50,7 +51,8 @@ public abstract class Files {
 	 * @return the {@link FileInboundChannelAdapterSpec} instance.
 	 */
 	public static FileInboundChannelAdapterSpec inboundAdapter(File directory,
-			Comparator receptionOrderComparator) {
+			@Nullable Comparator receptionOrderComparator) {
+
 		return new FileInboundChannelAdapterSpec(receptionOrderComparator).directory(directory);
 	}
 
@@ -197,7 +199,7 @@ public abstract class Files {
 	 * @param deleteFiles true to delete the file.
 	 * @return the {@link FileToStringTransformer}.
 	 */
-	public static FileToStringTransformer toStringTransformer(String charset, boolean deleteFiles) {
+	public static FileToStringTransformer toStringTransformer(@Nullable String charset, boolean deleteFiles) {
 		FileToStringTransformer transformer = new FileToStringTransformer();
 		if (charset != null) {
 			transformer.setCharset(charset);
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileInboundChannelAdapterSpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileInboundChannelAdapterSpec.java
index 1454660f88..5cf4c6fdbe 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileInboundChannelAdapterSpec.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileInboundChannelAdapterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2022 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.springframework.integration.file.filters.FileListFilter;
 import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
 import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource;
 import org.springframework.integration.metadata.MetadataStore;
+import org.springframework.lang.Nullable;
 
 /**
  * A {@link MessageSourceSpec} for an {@link AbstractInboundFileSynchronizingMessageSource}.
@@ -52,6 +53,7 @@ public abstract class RemoteFileInboundChannelAdapterSpec synchronizer; // NOSONAR final
 
+	@Nullable
 	private ExpressionFileListFilter expressionFileListFilter;
 
 	protected RemoteFileInboundChannelAdapterSpec(AbstractInboundFileSynchronizer synchronizer) {
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java
index 63b769879f..a566aea78a 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2020 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import org.springframework.integration.file.filters.RegexPatternFileListFilter;
 import org.springframework.integration.file.filters.SimplePatternFileListFilter;
 import org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway;
 import org.springframework.integration.file.support.FileExistsMode;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.Message;
 
 /**
@@ -50,12 +51,16 @@ public abstract class RemoteFileOutboundGatewaySpec>
 		implements ComponentsRegistration {
 
+	@Nullable
 	private CompositeFileListFilter filter;
 
+	@Nullable
 	private ExpressionFileListFilter expressionFileListFilter;
 
+	@Nullable
 	private ExpressionFileListFilter mputExpressionFileListFilter;
 
+	@Nullable
 	private CompositeFileListFilter mputFilter;
 
 	protected RemoteFileOutboundGatewaySpec(AbstractRemoteFileOutboundGateway outboundGateway) {
diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileStreamingInboundChannelAdapterSpec.java b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileStreamingInboundChannelAdapterSpec.java
index 2befbf7d39..94f09c89e5 100644
--- a/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileStreamingInboundChannelAdapterSpec.java
+++ b/spring-integration-file/src/main/java/org/springframework/integration/file/dsl/RemoteFileStreamingInboundChannelAdapterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.springframework.integration.expression.FunctionExpression;
 import org.springframework.integration.file.filters.ExpressionFileListFilter;
 import org.springframework.integration.file.filters.FileListFilter;
 import org.springframework.integration.file.remote.AbstractRemoteFileStreamingMessageSource;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.Message;
 
 /**
@@ -46,6 +47,7 @@ public abstract class RemoteFileStreamingInboundChannelAdapterSpec
 		implements ComponentsRegistration {
 
+	@Nullable
 	private ExpressionFileListFilter expressionFileListFilter;
 
 	/**
@@ -143,7 +145,7 @@ public abstract class RemoteFileStreamingInboundChannelAdapterSpec sessionFactory,
-			Comparator receptionOrderComparator) {
+			@Nullable Comparator receptionOrderComparator) {
 
 		return new FtpInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator);
 	}
@@ -82,7 +83,7 @@ public final class Ftp {
 	 */
 	public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter(
 			RemoteFileTemplate remoteFileTemplate,
-			Comparator receptionOrderComparator) {
+			@Nullable Comparator receptionOrderComparator) {
 
 		return new FtpStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator);
 	}
diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpInboundChannelAdapterSpec.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpInboundChannelAdapterSpec.java
index 19fca2f466..3fb88c2c2f 100644
--- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpInboundChannelAdapterSpec.java
+++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpInboundChannelAdapterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2022 the original author or authors.
+ * Copyright 2014-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import org.springframework.integration.ftp.filters.FtpSimplePatternFileListFilte
 import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer;
 import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizingMessageSource;
 import org.springframework.integration.metadata.SimpleMetadataStore;
+import org.springframework.lang.Nullable;
 
 /**
  * A {@link RemoteFileInboundChannelAdapterSpec} for an {@link FtpInboundFileSynchronizingMessageSource}.
@@ -43,7 +44,9 @@ public class FtpInboundChannelAdapterSpec
 		extends RemoteFileInboundChannelAdapterSpec {
 
-	protected FtpInboundChannelAdapterSpec(SessionFactory sessionFactory, Comparator comparator) {
+	protected FtpInboundChannelAdapterSpec(SessionFactory sessionFactory,
+			@Nullable Comparator comparator) {
+
 		super(new FtpInboundFileSynchronizer(sessionFactory));
 		this.target = new FtpInboundFileSynchronizingMessageSource(this.synchronizer, comparator);
 	}
diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpStreamingInboundChannelAdapterSpec.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpStreamingInboundChannelAdapterSpec.java
index 5d77f39082..14b0e00ae1 100644
--- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpStreamingInboundChannelAdapterSpec.java
+++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/FtpStreamingInboundChannelAdapterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2022 the original author or authors.
+ * Copyright 2014-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.springframework.integration.ftp.filters.FtpRegexPatternFileListFilter
 import org.springframework.integration.ftp.filters.FtpSimplePatternFileListFilter;
 import org.springframework.integration.ftp.inbound.FtpStreamingMessageSource;
 import org.springframework.integration.metadata.SimpleMetadataStore;
+import org.springframework.lang.Nullable;
 
 /**
  * A {@link RemoteFileStreamingInboundChannelAdapterSpec} for a {@link FtpStreamingMessageSource}.
@@ -43,7 +44,7 @@ public class FtpStreamingInboundChannelAdapterSpec
 		FtpStreamingMessageSource> {
 
 	protected FtpStreamingInboundChannelAdapterSpec(RemoteFileTemplate remoteFileTemplate,
-			Comparator comparator) {
+			@Nullable Comparator comparator) {
 
 		this.target = new FtpStreamingMessageSource(remoteFileTemplate, comparator);
 	}
diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/package-info.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/package-info.java
index c5c25396db..55e82bb003 100644
--- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/package-info.java
+++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/package-info.java
@@ -1,4 +1,6 @@
 /**
  * Provides FTP Components for the Java DSL.
  */
+@org.springframework.lang.NonNullApi
+@org.springframework.lang.NonNullFields
 package org.springframework.integration.ftp.dsl;
diff --git a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/dsl/package-info.java b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/dsl/package-info.java
index d06699f4c4..3930ab8ee1 100644
--- a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/dsl/package-info.java
+++ b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/dsl/package-info.java
@@ -1,4 +1,6 @@
 /**
  * Provides classes for Java DSL to support GraphQL components.
  */
+@org.springframework.lang.NonNullApi
+@org.springframework.lang.NonNullFields
 package org.springframework.integration.graphql.dsl;
diff --git a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandler.java b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandler.java
index 05b1fc5d2e..58edacdf8d 100644
--- a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandler.java
+++ b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2022 the original author or authors.
+ * Copyright 2022-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -47,8 +47,9 @@ public class GraphQlMessageHandler extends AbstractReplyProducingMessageHandler
 
 	private final ExecutionGraphQlService graphQlService;
 
-	private StandardEvaluationContext evaluationContext;
+	private StandardEvaluationContext evaluationContext = new StandardEvaluationContext();
 
+	@Nullable
 	private Expression operationExpression;
 
 	private Expression operationNameExpression = new SupplierExpression<>(() -> null);
@@ -142,11 +143,11 @@ public class GraphQlMessageHandler extends AbstractReplyProducingMessageHandler
 			graphQlRequest = (ExecutionGraphQlRequest) requestMessage.getPayload();
 		}
 		else {
-			Assert.notNull(this.operationExpression, "'operationExpression' must not be null");
 			String query = evaluateOperationExpression(requestMessage);
 			String operationName = evaluateOperationNameExpression(requestMessage);
 			Map variables = evaluateVariablesExpression(requestMessage);
 			String id = evaluateExecutionIdExpression(requestMessage);
+			Assert.notNull(id, "The 'executionIdExpression' must not evaluate to null");
 			graphQlRequest = new DefaultExecutionGraphQlRequest(query, operationName, variables, null, id, this.locale);
 		}
 
@@ -155,20 +156,24 @@ public class GraphQlMessageHandler extends AbstractReplyProducingMessageHandler
 	}
 
 	private String evaluateOperationExpression(Message message) {
+		Assert.notNull(this.operationExpression, "'operationExpression' must not be null");
 		String operation = this.operationExpression.getValue(this.evaluationContext, message, String.class);
 		Assert.notNull(operation, "'operationExpression' must not evaluate to null");
 		return operation;
 	}
 
+	@Nullable
 	private String evaluateOperationNameExpression(Message message) {
 		return this.operationNameExpression.getValue(this.evaluationContext, message, String.class);
 	}
 
+	@Nullable
 	@SuppressWarnings("unchecked")
 	private Map evaluateVariablesExpression(Message message) {
 		return this.variablesExpression.getValue(this.evaluationContext, message, Map.class);
 	}
 
+	@Nullable
 	private String evaluateExecutionIdExpression(Message message) {
 		return this.executionIdExpression.getValue(this.evaluationContext, message, String.class);
 	}
diff --git a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/package-info.java b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/package-info.java
index 07a6db100a..da8bcdfddd 100644
--- a/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/package-info.java
+++ b/spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/package-info.java
@@ -1,4 +1,6 @@
 /**
  * Provides classes for GraphQL outbound channel adapters.
  */
+@org.springframework.lang.NonNullApi
+@org.springframework.lang.NonNullFields
 package org.springframework.integration.graphql.outbound;
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/BaseHttpMessageHandlerSpec.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/BaseHttpMessageHandlerSpec.java
index 95962cdfa6..1050b9745c 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/BaseHttpMessageHandlerSpec.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/BaseHttpMessageHandlerSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017-2021 the original author or authors.
+ * Copyright 2017-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ public abstract class BaseHttpMessageHandlerSpec S expectedResponseTypeFunction(
 			Function, ?> expectedResponseTypeFunction) {
+
 		return expectedResponseTypeExpression(new FunctionExpression<>(expectedResponseTypeFunction));
 	}
 
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java
index 939839fbd9..00ae424fa5 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2019 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.springframework.expression.common.LiteralExpression;
 import org.springframework.integration.expression.FunctionExpression;
 import org.springframework.integration.http.inbound.HttpRequestHandlingController;
 import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway;
+import org.springframework.lang.Nullable;
 import org.springframework.messaging.Message;
 import org.springframework.util.Assert;
 import org.springframework.web.client.RestTemplate;
@@ -84,7 +85,7 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundChannelAdapter(URI uri, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundChannelAdapter(URI uri, @Nullable RestTemplate restTemplate) {
 		return new HttpMessageHandlerSpec(uri, restTemplate).expectReply(false);
 	}
 
@@ -95,7 +96,7 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundChannelAdapter(String uri, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundChannelAdapter(String uri, @Nullable RestTemplate restTemplate) {
 		return new HttpMessageHandlerSpec(uri, restTemplate).expectReply(false);
 	}
 
@@ -122,7 +123,9 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundChannelAdapter(Expression uriExpression, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundChannelAdapter(Expression uriExpression,
+			@Nullable RestTemplate restTemplate) {
+
 		return new HttpMessageHandlerSpec(uriExpression, restTemplate).expectReply(false);
 	}
 
@@ -172,7 +175,7 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundGateway(URI uri, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundGateway(URI uri, @Nullable RestTemplate restTemplate) {
 		return new HttpMessageHandlerSpec(uri, restTemplate);
 	}
 
@@ -183,7 +186,7 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundGateway(String uri, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundGateway(String uri, @Nullable RestTemplate restTemplate) {
 		return new HttpMessageHandlerSpec(uri, restTemplate);
 	}
 
@@ -210,7 +213,9 @@ public final class Http {
 	 * @param restTemplate {@link RestTemplate} to use.
 	 * @return the HttpMessageHandlerSpec instance
 	 */
-	public static HttpMessageHandlerSpec outboundGateway(Expression uriExpression, RestTemplate restTemplate) {
+	public static HttpMessageHandlerSpec outboundGateway(Expression uriExpression,
+			@Nullable RestTemplate restTemplate) {
+
 		return new HttpMessageHandlerSpec(uriExpression, restTemplate);
 	}
 
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java
index 384d9df525..fc955e9ee0 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017-2021 the original author or authors.
+ * Copyright 2017-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.springframework.integration.http.inbound.CrossOrigin;
 import org.springframework.integration.http.inbound.RequestMapping;
 import org.springframework.integration.http.support.DefaultHttpHeaderMapper;
 import org.springframework.integration.mapping.HeaderMapper;
+import org.springframework.lang.Nullable;
 import org.springframework.util.Assert;
 import org.springframework.validation.Validator;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -60,6 +61,7 @@ public abstract class HttpInboundEndpointSupportSpec headerMapper = DefaultHttpHeaderMapper.inboundMapper(); // NOSONAR final
 
+	@Nullable
 	private HeaderMapper explicitHeaderMapper;
 
 	protected HttpInboundEndpointSupportSpec(E gateway, String... path) {
@@ -216,7 +218,7 @@ public abstract class HttpInboundEndpointSupportSpec {
 
+	@Nullable
 	private final RestTemplate restTemplate;
 
-	protected HttpMessageHandlerSpec(URI uri, RestTemplate restTemplate) {
+	protected HttpMessageHandlerSpec(URI uri, @Nullable RestTemplate restTemplate) {
 		this(new ValueExpression<>(uri), restTemplate);
 	}
 
-	protected HttpMessageHandlerSpec(String uri, RestTemplate restTemplate) {
+	protected HttpMessageHandlerSpec(String uri, @Nullable RestTemplate restTemplate) {
 		this(new LiteralExpression(uri), restTemplate);
 	}
 
-	protected HttpMessageHandlerSpec(Expression uriExpression, RestTemplate restTemplate) {
+	protected HttpMessageHandlerSpec(Expression uriExpression, @Nullable RestTemplate restTemplate) {
 		super(new HttpRequestExecutingMessageHandler(uriExpression, restTemplate));
 		this.restTemplate = restTemplate;
 	}
diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java
index d650fcd421..f0bab4f1ed 100644
--- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java
+++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/package-info.java
@@ -1,4 +1,6 @@
 /**
  * Provides HTTP Components support for Spring Integration Java DSL.
  */
+@org.springframework.lang.NonNullApi
+@org.springframework.lang.NonNullFields
 package org.springframework.integration.http.dsl;
diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java
index e3cba216ff..792d0adf8f 100644
--- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java
+++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/Jms.java
@@ -55,7 +55,9 @@ public final class Jms {
 	 */
 	public static JmsPollableMessageChannelSpec pollableChannel(@Nullable String id,
 			ConnectionFactory connectionFactory) {
-		JmsPollableMessageChannelSpec spec = new JmsPollableMessageChannelSpec<>(connectionFactory);
+
+		JmsPollableMessageChannelSpec spec =
+				new JmsPollableMessageChannelSpec<>(connectionFactory);
 		return spec.id(id);
 	}
 
@@ -166,14 +168,9 @@ public final class Jms {
 	public static JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec
 	inboundGateway(ConnectionFactory connectionFactory) {
 
-		try {
-			return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<>(
-					new JmsDefaultListenerContainerSpec()
-							.connectionFactory(connectionFactory));
-		}
-		catch (Exception e) {
-			throw new IllegalStateException(e);
-		}
+		return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<>(
+				new JmsDefaultListenerContainerSpec()
+						.connectionFactory(connectionFactory));
 	}
 
 	/**
@@ -189,15 +186,10 @@ public final class Jms {
 	JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec inboundGateway(
 			ConnectionFactory connectionFactory, Class containerClass) {
 
-		try {
-			JmsListenerContainerSpec spec =
-					new JmsListenerContainerSpec<>(containerClass)
-							.connectionFactory(connectionFactory);
-			return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec(spec);
-		}
-		catch (Exception e) {
-			throw new IllegalStateException(e);
-		}
+		JmsListenerContainerSpec spec =
+				new JmsListenerContainerSpec<>(containerClass)
+						.connectionFactory(connectionFactory);
+		return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec(spec);
 	}
 
 	/**
diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java
index d40296dc4d..6f4c96ab47 100644
--- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java
+++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsDestinationAccessorSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016-2021 the original author or authors.
+ * Copyright 2016-2023 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import jakarta.jms.ConnectionFactory;
 import org.springframework.integration.dsl.IntegrationComponentSpec;
 import org.springframework.jms.support.destination.DestinationResolver;
 import org.springframework.jms.support.destination.JmsDestinationAccessor;
+import org.springframework.lang.Nullable;
 
 /**
  * A base {@link IntegrationComponentSpec} for {@link JmsDestinationAccessor}s.
@@ -45,7 +46,7 @@ public abstract class JmsDestinationAccessorSpecfalse, which means that
-	 * deletion occurs on a per object basis if a collection of entities is being
+	 * deletion occurs on a per-object basis if a collection of entities is being
 	 * deleted.
 	 *

If set to 'true' the elements of the payload are deleted as a batch - * operation. Be aware that this exhibits issues in regards to cascaded deletes. + * operation. Be aware that this exhibits issues in regard to cascaded deletes. *

The specification 'JSR 317: Java Persistence API, Version 2.0' does not * support cascaded deletes in batch operations. The specification states in * chapter 4.10: @@ -152,7 +152,7 @@ public class JpaInboundChannelAdapterSpec } /** - * Set the maximum number of results expression. It has be a non null value + * Set the maximum number of results expression. It has to be a non-null value * Not setting one will default to the behavior of fetching all the records * @param maxResults the maximum number of results to retrieve * @return the spec diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java index ef058bca55..d4794ebe6d 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/JpaRetrievingOutboundGatewaySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,10 +144,10 @@ public class JpaRetrievingOutboundGatewaySpec extends JpaBaseOutboundEndpointSpe /** * If not set, this property defaults to false, which means that - * deletion occurs on a per object basis if a collection of entities is being + * deletion occurs on a per-object basis if a collection of entities is being * deleted. *

If set to 'true' the elements of the payload are deleted as a batch - * operation. Be aware that this exhibits issues in regards to cascaded deletes. + * operation. Be aware that this exhibits issues in regard to cascaded deletes. *

The specification 'JSR 317: Java Persistence API, Version 2.0' does not * support cascaded deletes in batch operations. The specification states in * chapter 4.10: diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java index b1c365ffc5..0c03315749 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides JPA Components support for Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.jpa.dsl; diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/AbstractKafkaChannelSpec.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/AbstractKafkaChannelSpec.java index 328aa71c79..c22f000bb3 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/AbstractKafkaChannelSpec.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/AbstractKafkaChannelSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.springframework.integration.kafka.dsl; import org.springframework.integration.dsl.MessageChannelSpec; import org.springframework.integration.kafka.channel.AbstractKafkaChannel; +import org.springframework.lang.Nullable; /** * @@ -34,10 +35,11 @@ import org.springframework.integration.kafka.channel.AbstractKafkaChannel; public abstract class AbstractKafkaChannelSpec, C extends AbstractKafkaChannel> extends MessageChannelSpec { + @Nullable protected String groupId; // NOSONAR @Override - public S id(String idToSet) { // NOSONAR - increase visibility + public S id(@Nullable String idToSet) { // NOSONAR - increase visibility return super.id(idToSet); } diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundChannelAdapterSpec.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundChannelAdapterSpec.java index 9d5dec04fd..ee5d817a93 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundChannelAdapterSpec.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 the original author or authors. + * Copyright 2018-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public class KafkaInboundChannelAdapterSpec */ KafkaInboundChannelAdapterSpec(ConsumerFactory consumerFactory, ConsumerProperties consumerProperties, boolean allowMultiFetch) { + this.target = new KafkaMessageSource<>(consumerFactory, consumerProperties, allowMultiFetch); } diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundGatewaySpec.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundGatewaySpec.java index f06a9d2ec4..6b300ec4e5 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundGatewaySpec.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaInboundGatewaySpec.java @@ -17,6 +17,7 @@ package org.springframework.integration.kafka.dsl; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -26,7 +27,6 @@ import org.apache.kafka.common.TopicPartition; import org.springframework.integration.dsl.ComponentsRegistration; import org.springframework.integration.dsl.MessagingGatewaySpec; import org.springframework.integration.kafka.inbound.KafkaInboundGateway; -import org.springframework.integration.support.ObjectStringMapBuilder; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.listener.AbstractMessageListenerContainer; import org.springframework.kafka.listener.ConsumerSeekAware; @@ -164,10 +164,10 @@ public class KafkaInboundGatewaySpec getComponentsToRegister() { - return new ObjectStringMapBuilder() - .put(this.containerSpec.getObject(), this.containerSpec.getId()) - .put(this.templateSpec.getObject(), this.templateSpec.getId()) - .get(); + Map components = new HashMap<>(); + components.put(this.containerSpec.getObject(), this.containerSpec.getId()); + components.put(this.templateSpec.getObject(), this.templateSpec.getId()); + return components; } } diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaMessageDrivenChannelAdapterSpec.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaMessageDrivenChannelAdapterSpec.java index 8d3062966d..c6c079cfda 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaMessageDrivenChannelAdapterSpec.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaMessageDrivenChannelAdapterSpec.java @@ -141,7 +141,7 @@ public class KafkaMessageDrivenChannelAdapterSpec } @Override - public KafkaMessageListenerContainerSpec id(String id) { // NOSONAR - increase visibility + public KafkaMessageListenerContainerSpec id(@Nullable String id) { // NOSONAR - increase visibility return super.id(id); } @@ -205,8 +206,8 @@ public class KafkaMessageListenerContainerSpec /** * Set whether to call consumer.commitSync() or commitAsync() when the * container is responsible for commits. Default true. See - * https://github.com/spring-projects/spring-kafka/issues/62 At the time of - * writing, async commits are not entirely reliable. + * . + * At the time of writing, async commits are not entirely reliable. * @param syncCommits true to use commitSync(). * @return the spec. * @see ContainerProperties#setSyncCommits(boolean) diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaTemplateSpec.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaTemplateSpec.java index 0da850faab..2ec42fbc90 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaTemplateSpec.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/KafkaTemplateSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 the original author or authors. + * Copyright 2018-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.ProducerFactory; import org.springframework.kafka.support.ProducerListener; import org.springframework.kafka.support.converter.RecordMessageConverter; +import org.springframework.lang.Nullable; /** * An {@link IntegrationComponentSpec} implementation for the {@link KafkaTemplate}. @@ -49,7 +50,7 @@ public class KafkaTemplateSpec } @Override - public KafkaTemplateSpec id(String id) { // NOSONAR - visibility + public KafkaTemplateSpec id(@Nullable String id) { // NOSONAR - visibility return super.id(id); } diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/package-info.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/package-info.java index b70ca47e14..53f5ad837b 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/package-info.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides Spring Integration Java DSL Components support for Apache Kafka. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.kafka.dsl; diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java index 5870bbb7f2..66e207d80b 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,6 +115,7 @@ public final class Mail { */ public static Pop3MailInboundChannelAdapterSpec pop3InboundAdapter(String host, int port, String username, String password) { + return new Pop3MailInboundChannelAdapterSpec(host, port, username, password); } @@ -191,7 +192,7 @@ public final class Mail { * @param charset the charset to use when the default is not appropriate. * @return the transformer. */ - public static MailToStringTransformer toStringTransformer(String charset) { + public static MailToStringTransformer toStringTransformer(@Nullable String charset) { MailToStringTransformer transformer = new MailToStringTransformer(); if (charset != null) { transformer.setCharset(charset); diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailHeadersBuilder.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailHeadersBuilder.java index 4009274cb5..23b3a7403b 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailHeadersBuilder.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/MailHeadersBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder subjectFunction(Function, String> subject) { - return put(MailHeaders.SUBJECT, new FunctionExpression>(subject)); + return put(MailHeaders.SUBJECT, new FunctionExpression<>(subject)); } /** @@ -86,7 +86,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder toFunction(Function, String[]> to) { - return put(MailHeaders.TO, new FunctionExpression>(to)); + return put(MailHeaders.TO, new FunctionExpression<>(to)); } /** @@ -115,7 +115,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder ccFunction(Function, String[]> cc) { - return put(MailHeaders.CC, new FunctionExpression>(cc)); + return put(MailHeaders.CC, new FunctionExpression<>(cc)); } /** @@ -144,7 +144,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder bccFunction(Function, String[]> bcc) { - return put(MailHeaders.BCC, new FunctionExpression>(bcc)); + return put(MailHeaders.BCC, new FunctionExpression<>(bcc)); } /** @@ -157,7 +157,7 @@ public class MailHeadersBuilder extends MapBuilder the message payload type. * @return the builder. */ public

MailHeadersBuilder fromFunction(Function, String> from) { - return put(MailHeaders.FROM, new FunctionExpression>(from)); + return put(MailHeaders.FROM, new FunctionExpression<>(from)); } /** @@ -202,7 +202,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder replyToFunction(Function, String> replyTo) { - return put(MailHeaders.REPLY_TO, new FunctionExpression>(replyTo)); + return put(MailHeaders.REPLY_TO, new FunctionExpression<>(replyTo)); } /** @@ -236,7 +236,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder multipartModeFunction(Function, Integer> multipartMode) { - return put(MailHeaders.MULTIPART_MODE, new FunctionExpression>(multipartMode)); + return put(MailHeaders.MULTIPART_MODE, new FunctionExpression<>(multipartMode)); } /** @@ -264,7 +264,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder attachmentFilenameFunction(Function, String> attachmentFilename) { - return put(MailHeaders.ATTACHMENT_FILENAME, new FunctionExpression>(attachmentFilename)); + return put(MailHeaders.ATTACHMENT_FILENAME, new FunctionExpression<>(attachmentFilename)); } /** @@ -292,7 +292,7 @@ public class MailHeadersBuilder extends MapBuilder MailHeadersBuilder contentTypeFunction(Function, String> contentType) { - return put(MailHeaders.CONTENT_TYPE, new FunctionExpression>(contentType)); + return put(MailHeaders.CONTENT_TYPE, new FunctionExpression<>(contentType)); } private MailHeadersBuilder putExpression(String key, String expression) { diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/package-info.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/package-info.java index e15dcb2e9d..d2e39f7120 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/package-info.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides Mail Components for the Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.mail.dsl; diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/package-info.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/package-info.java index 395197955d..8f05105290 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/package-info.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides MongoDB Components support for Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.mongodb.dsl; diff --git a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/dsl/package-info.java b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/dsl/package-info.java index 043505dda2..2c264693da 100644 --- a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/dsl/package-info.java +++ b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/dsl/package-info.java @@ -2,4 +2,5 @@ * Provides classes for supporting Java DSL for R2DBC components. */ @org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.r2dbc.dsl; diff --git a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/R2dbcMessageSource.java b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/R2dbcMessageSource.java index c4669496a6..e856280d31 100644 --- a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/R2dbcMessageSource.java +++ b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/R2dbcMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.springframework.expression.common.LiteralExpression; import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.integration.endpoint.AbstractMessageSource; import org.springframework.integration.expression.ExpressionUtils; +import org.springframework.lang.Nullable; import org.springframework.r2dbc.core.ColumnMapRowMapper; import org.springframework.r2dbc.core.DatabaseClient; import org.springframework.r2dbc.core.RowsFetchSpec; @@ -75,10 +76,12 @@ public class R2dbcMessageSource extends AbstractMessageSource> { private boolean expectSingleResult = false; - private StandardEvaluationContext evaluationContext; + private StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); + @Nullable private String updateSql; + @Nullable private BiFunction bindFunction; private volatile boolean initialized = false; diff --git a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/package-info.java b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/package-info.java index 501e1ccd15..339d0f161d 100644 --- a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/package-info.java +++ b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/inbound/package-info.java @@ -2,4 +2,5 @@ * Provides classes for supporting R2DBC inbound components. */ @org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.r2dbc.inbound; diff --git a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/R2dbcMessageHandler.java b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/R2dbcMessageHandler.java index 2debbb7232..8cfbe59f41 100644 --- a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/R2dbcMessageHandler.java +++ b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/R2dbcMessageHandler.java @@ -56,7 +56,7 @@ public class R2dbcMessageHandler extends AbstractReactiveMessageHandler { private final StatementMapper statementMapper; - private StandardEvaluationContext evaluationContext; + private StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); private Expression queryTypeExpression = new ValueExpression<>(Type.INSERT); @@ -170,7 +170,8 @@ public class R2dbcMessageHandler extends AbstractReactiveMessageHandler { private Mono handleDelete(Message message) { if (this.tableNameExpression != null) { - String tableName = evaluateTableNameExpression(message); + String tableName = this.tableNameExpression.getValue(this.evaluationContext, message, String.class); + Assert.notNull(tableName, "'tableNameExpression' must not evaluate to null"); Criteria criteria = evaluateCriteriaExpression(message); StatementMapper.DeleteSpec deleteSpec = this.statementMapper.createDelete(tableName) @@ -188,7 +189,8 @@ public class R2dbcMessageHandler extends AbstractReactiveMessageHandler { private Mono handleUpdate(Message message) { if (this.tableNameExpression != null) { - String tableName = evaluateTableNameExpression(message); + String tableName = this.tableNameExpression.getValue(this.evaluationContext, message, String.class); + Assert.notNull(tableName, "'tableNameExpression' must not evaluate to null"); Map values = evaluateValuesExpression(message); Map updateMap = transformIntoSqlIdentifierMap(values); Criteria criteria = evaluateCriteriaExpression(message); @@ -216,7 +218,8 @@ public class R2dbcMessageHandler extends AbstractReactiveMessageHandler { @SuppressWarnings("deprecation") private Mono handleInsert(Message message) { if (this.tableNameExpression != null) { - String tableName = evaluateTableNameExpression(message); + String tableName = this.tableNameExpression.getValue(this.evaluationContext, message, String.class); + Assert.notNull(tableName, "'tableNameExpression' must not evaluate to null"); Map values = evaluateValuesExpression(message); StatementMapper.InsertSpec insertSpec = this.statementMapper.createInsert(tableName); @@ -237,13 +240,6 @@ public class R2dbcMessageHandler extends AbstractReactiveMessageHandler { } } - private String evaluateTableNameExpression(Message message) { - String tableName = - this.tableNameExpression.getValue(this.evaluationContext, message, String.class); // NOSONAR - Assert.notNull(tableName, "'tableNameExpression' must not evaluate to null"); - return tableName; - } - @SuppressWarnings("unchecked") private Map evaluateValuesExpression(Message message) { Assert.notNull(this.valuesExpression, diff --git a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/package-info.java b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/package-info.java index 20c7e8a1b0..ebe2b74222 100644 --- a/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/package-info.java +++ b/spring-integration-r2dbc/src/main/java/org/springframework/integration/r2dbc/outbound/package-info.java @@ -2,4 +2,5 @@ * Provides classes for supporting R2DBC outbound components. */ @org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.r2dbc.outbound; diff --git a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/package-info.java b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/package-info.java index 28166a8732..a2cfe7f362 100644 --- a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/package-info.java +++ b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/package-info.java @@ -2,4 +2,5 @@ * Provides RSocket Components support for Spring Integration Java DSL. */ @org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.rsocket.dsl; diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/DslScriptExecutingMessageProcessor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/DslScriptExecutingMessageProcessor.java index 292899b0f7..386502c307 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/DslScriptExecutingMessageProcessor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/DslScriptExecutingMessageProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import org.springframework.util.StringUtils; * The adapter {@link MessageProcessor} around {@link AbstractScriptExecutingMessageProcessor}. * Delegates to the {@code GroovyScriptExecutingMessageProcessor}, if provided {@link #lang} * matches to {@code groovy} string and {@code spring-integration-groovy} jar is in classpath. - * Otherwise to the {@link ScriptExecutingMessageProcessor}. + * Otherwise, to the {@link ScriptExecutingMessageProcessor}. * * @author Artem Bilan * diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/ScriptSpec.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/ScriptSpec.java index 513ee86cc6..04ad106eb5 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/ScriptSpec.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/ScriptSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ public class ScriptSpec extends MessageProcessorSpec { private ScriptVariableGenerator variableGenerator; - private Map variables = new HashMap(); + private final Map variables = new HashMap<>(); ScriptSpec(Resource scriptResource) { Assert.notNull(scriptResource, "'scriptResource' must not be null"); diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/package-info.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/package-info.java index 625b5db41f..f6ef9725d3 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/package-info.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/dsl/package-info.java @@ -1,4 +1,5 @@ /** * Provides Scripting Components support for Spring Integration Java DSL. */ +@org.springframework.lang.NonNullApi package org.springframework.integration.scripting.dsl; diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java index 9a2a9540a8..f588aff130 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.file.support.FileExistsMode; import org.springframework.integration.sftp.gateway.SftpOutboundGateway; import org.springframework.integration.sftp.session.SftpRemoteFileTemplate; +import org.springframework.lang.Nullable; /** * The factory for SFTP components. @@ -56,7 +57,7 @@ public final class Sftp { * @return the spec. */ public static SftpInboundChannelAdapterSpec inboundAdapter(SessionFactory sessionFactory, - Comparator receptionOrderComparator) { + @Nullable Comparator receptionOrderComparator) { return new SftpInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator); } @@ -82,7 +83,7 @@ public final class Sftp { */ public static SftpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate, - Comparator receptionOrderComparator) { + @Nullable Comparator receptionOrderComparator) { return new SftpStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator); } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpInboundChannelAdapterSpec.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpInboundChannelAdapterSpec.java index e3a9ccfb76..204414c2ee 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpInboundChannelAdapterSpec.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilt import org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter; import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer; import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizingMessageSource; +import org.springframework.lang.Nullable; /** * A {@link RemoteFileInboundChannelAdapterSpec} for an {@link SftpInboundFileSynchronizingMessageSource}. @@ -44,7 +45,7 @@ public class SftpInboundChannelAdapterSpec SftpInboundFileSynchronizingMessageSource> { protected SftpInboundChannelAdapterSpec(SessionFactory sessionFactory, - Comparator comparator) { + @Nullable Comparator comparator) { super(new SftpInboundFileSynchronizer(sessionFactory)); this.target = new SftpInboundFileSynchronizingMessageSource(this.synchronizer, comparator); diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpStreamingInboundChannelAdapterSpec.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpStreamingInboundChannelAdapterSpec.java index 99c51d2409..fbfcb10213 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpStreamingInboundChannelAdapterSpec.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/SftpStreamingInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFile import org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter; import org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter; import org.springframework.integration.sftp.inbound.SftpStreamingMessageSource; +import org.springframework.lang.Nullable; /** * @author Gary Russell @@ -41,7 +42,7 @@ public class SftpStreamingInboundChannelAdapterSpec SftpStreamingInboundChannelAdapterSpec, SftpStreamingMessageSource> { protected SftpStreamingInboundChannelAdapterSpec(RemoteFileTemplate remoteFileTemplate, - Comparator comparator) { + @Nullable Comparator comparator) { this.target = new SftpStreamingMessageSource(remoteFileTemplate, comparator); } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/package-info.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/package-info.java index 1e1064951a..d17169b3ed 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/package-info.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides SFTP Components for the Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.sftp.dsl; diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/Smb.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/Smb.java index 386978535d..0bbce68f0b 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/Smb.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/Smb.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,13 @@ import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.file.support.FileExistsMode; import org.springframework.integration.smb.outbound.SmbOutboundGateway; import org.springframework.integration.smb.session.SmbRemoteFileTemplate; +import org.springframework.lang.Nullable; /** * The factory for SMB components. * * @author Gregory Bragg + * @author Artem Bilan * * @since 6.0 */ @@ -54,7 +56,7 @@ public final class Smb { * @return the spec. */ public static SmbInboundChannelAdapterSpec inboundAdapter(SessionFactory sessionFactory, - Comparator receptionOrderComparator) { + @Nullable Comparator receptionOrderComparator) { return new SmbInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator); } @@ -80,7 +82,7 @@ public final class Smb { */ public static SmbStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate, - Comparator receptionOrderComparator) { + @Nullable Comparator receptionOrderComparator) { return new SmbStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator); } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbInboundChannelAdapterSpec.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbInboundChannelAdapterSpec.java index c7990d97ec..5605fa340d 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbInboundChannelAdapterSpec.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,13 @@ import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter; import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer; import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource; +import org.springframework.lang.Nullable; /** * A {@link RemoteFileInboundChannelAdapterSpec} for an {@link SmbInboundFileSynchronizingMessageSource}. * * @author Gregory Bragg + * @author Artem Bilan * * @since 6.0 */ @@ -43,7 +45,9 @@ public class SmbInboundChannelAdapterSpec extends RemoteFileInboundChannelAdapterSpec { - protected SmbInboundChannelAdapterSpec(SessionFactory sessionFactory, Comparator comparator) { + protected SmbInboundChannelAdapterSpec(SessionFactory sessionFactory, + @Nullable Comparator comparator) { + super(new SmbInboundFileSynchronizer(sessionFactory)); this.target = new SmbInboundFileSynchronizingMessageSource(this.synchronizer, comparator); } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbStreamingInboundChannelAdapterSpec.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbStreamingInboundChannelAdapterSpec.java index 4768f2bd76..d3fca1737c 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbStreamingInboundChannelAdapterSpec.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbStreamingInboundChannelAdapterSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,11 +29,13 @@ import org.springframework.integration.smb.filters.SmbPersistentAcceptOnceFileLi import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter; import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter; import org.springframework.integration.smb.inbound.SmbStreamingMessageSource; +import org.springframework.lang.Nullable; /** * A {@link RemoteFileStreamingInboundChannelAdapterSpec} for a {@link SmbStreamingMessageSource}. * * @author Gregory Bragg + * @author Artem Bilan * * @since 6.0 */ @@ -42,7 +44,7 @@ public class SmbStreamingInboundChannelAdapterSpec SmbStreamingMessageSource> { protected SmbStreamingInboundChannelAdapterSpec(RemoteFileTemplate remoteFileTemplate, - Comparator comparator) { + @Nullable Comparator comparator) { this.target = new SmbStreamingMessageSource(remoteFileTemplate, comparator); } diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/package-info.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/package-info.java index 58576b42ef..bf53725827 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/package-info.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides SMB Components for the Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.smb.dsl; diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java index 707d77c5d1..1ffcbd64d7 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import java.util.function.Function; import org.springframework.expression.Expression; import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.webflux.inbound.WebFluxInboundEndpoint; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.web.reactive.function.client.WebClient; @@ -82,7 +83,7 @@ public final class WebFlux { * @param webClient {@link WebClient} to use. * @return the WebFluxMessageHandlerSpec instance */ - public static WebFluxMessageHandlerSpec outboundChannelAdapter(URI uri, WebClient webClient) { + public static WebFluxMessageHandlerSpec outboundChannelAdapter(URI uri, @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uri, webClient) .expectReply(false); } @@ -94,7 +95,7 @@ public final class WebFlux { * @param webClient {@link WebClient} to use. * @return the WebFluxMessageHandlerSpec instance */ - public static WebFluxMessageHandlerSpec outboundChannelAdapter(String uri, WebClient webClient) { + public static WebFluxMessageHandlerSpec outboundChannelAdapter(String uri, @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uri, webClient) .expectReply(false); } @@ -123,7 +124,7 @@ public final class WebFlux { * @return the WebFluxMessageHandlerSpec instance */ public static WebFluxMessageHandlerSpec outboundChannelAdapter(Expression uriExpression, - WebClient webClient) { + @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uriExpression, webClient) .expectReply(false); @@ -177,7 +178,7 @@ public final class WebFlux { * @param webClient {@link WebClient} to use. * @return the WebFluxMessageHandlerSpec instance */ - public static WebFluxMessageHandlerSpec outboundGateway(URI uri, WebClient webClient) { + public static WebFluxMessageHandlerSpec outboundGateway(URI uri, @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uri, webClient); } @@ -188,7 +189,7 @@ public final class WebFlux { * @param webClient {@link WebClient} to use. * @return the WebFluxMessageHandlerSpec instance */ - public static WebFluxMessageHandlerSpec outboundGateway(String uri, WebClient webClient) { + public static WebFluxMessageHandlerSpec outboundGateway(String uri, @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uri, webClient); } @@ -202,7 +203,7 @@ public final class WebFlux { * @return the WebFluxMessageHandlerSpec instance */ public static

WebFluxMessageHandlerSpec outboundGateway(Function, ?> uriFunction, - WebClient webClient) { + @Nullable WebClient webClient) { return outboundGateway(new FunctionExpression<>(uriFunction), webClient); } @@ -216,7 +217,7 @@ public final class WebFlux { * @return the WebFluxMessageHandlerSpec instance */ public static WebFluxMessageHandlerSpec outboundGateway(Expression uriExpression, - WebClient webClient) { + @Nullable WebClient webClient) { return new WebFluxMessageHandlerSpec(uriExpression, webClient); } diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFluxMessageHandlerSpec.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFluxMessageHandlerSpec.java index b6a9a99b06..7e907bf641 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFluxMessageHandlerSpec.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFluxMessageHandlerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.expression.ValueExpression; import org.springframework.integration.http.dsl.BaseHttpMessageHandlerSpec; import org.springframework.integration.webflux.outbound.WebFluxRequestExecutingMessageHandler; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.web.reactive.function.BodyExtractor; import org.springframework.web.reactive.function.client.WebClient; @@ -46,17 +47,18 @@ import org.springframework.web.reactive.function.client.WebClient; public class WebFluxMessageHandlerSpec extends BaseHttpMessageHandlerSpec { + @Nullable protected final WebClient webClient; // NOSONAR - final - protected WebFluxMessageHandlerSpec(URI uri, WebClient webClient) { + protected WebFluxMessageHandlerSpec(URI uri, @Nullable WebClient webClient) { this(new ValueExpression<>(uri), webClient); } - protected WebFluxMessageHandlerSpec(String uri, WebClient webClient) { + protected WebFluxMessageHandlerSpec(String uri, @Nullable WebClient webClient) { this(new LiteralExpression(uri), webClient); } - protected WebFluxMessageHandlerSpec(Expression uriExpression, WebClient webClient) { + protected WebFluxMessageHandlerSpec(Expression uriExpression, @Nullable WebClient webClient) { super(new WebFluxRequestExecutingMessageHandler(uriExpression, webClient)); this.webClient = webClient; } diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/package-info.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/package-info.java index 965db424f4..961f399976 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/package-info.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/package-info.java @@ -1,4 +1,6 @@ /** * Provides WebFlux Components support for Spring Integration Java DSL. */ +@org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.webflux.dsl; diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index 42f16e2391..5481b2dd31 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Document; +import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessagingException; import org.springframework.util.Assert; @@ -65,7 +66,8 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG this(destinationProvider, sourceExtractor, null); } - public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor, + public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, + @Nullable SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { super(destinationProvider, messageFactory); @@ -80,7 +82,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG this(uri, sourceExtractor, null); } - public SimpleWebServiceOutboundGateway(String uri, SourceExtractor sourceExtractor, + public SimpleWebServiceOutboundGateway(String uri, @Nullable SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { super(uri, messageFactory); diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/SimpleWsOutboundGatewaySpec.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/SimpleWsOutboundGatewaySpec.java index 92ce200669..4560a6345f 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/SimpleWsOutboundGatewaySpec.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/SimpleWsOutboundGatewaySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.util.Arrays; import org.springframework.integration.JavaUtils; import org.springframework.integration.ws.SimpleWebServiceOutboundGateway; +import org.springframework.lang.Nullable; import org.springframework.ws.WebServiceMessageFactory; import org.springframework.ws.client.core.FaultMessageResolver; import org.springframework.ws.client.core.SourceExtractor; @@ -39,6 +40,7 @@ import org.springframework.ws.transport.WebServiceMessageSender; public class SimpleWsOutboundGatewaySpec extends BaseWsOutboundGatewaySpec { + @Nullable protected SourceExtractor sourceExtractor; // NOSONAR protected SimpleWsOutboundGatewaySpec(WebServiceTemplate template) { diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/package-info.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/package-info.java index b2fce402d2..b10046610d 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/package-info.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/package-info.java @@ -1,4 +1,5 @@ /** * Contains classes for DSL support. */ +@org.springframework.lang.NonNullApi package org.springframework.integration.ws.dsl; diff --git a/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/dsl/package-info.java b/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/dsl/package-info.java index cfb4e53cfa..5fd970e23a 100644 --- a/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/dsl/package-info.java +++ b/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/dsl/package-info.java @@ -2,4 +2,5 @@ * Provides classes for supporting ZeroMQ component via Java DSL. */ @org.springframework.lang.NonNullApi +@org.springframework.lang.NonNullFields package org.springframework.integration.zeromq.dsl;