Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes for configuration - parsers, namespace handlers.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.webflux.config;
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import java.net.URI;
import java.util.function.Function;

import org.jspecify.annotations.Nullable;

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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.net.URI;
import java.util.function.Function;

import org.jspecify.annotations.Nullable;

import org.springframework.core.ParameterizedTypeReference;
import org.springframework.expression.Expression;
import org.springframework.expression.common.LiteralExpression;
Expand All @@ -27,7 +29,6 @@
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;
Expand All @@ -48,7 +49,7 @@ public class WebFluxMessageHandlerSpec
extends BaseHttpMessageHandlerSpec<WebFluxMessageHandlerSpec, WebFluxRequestExecutingMessageHandler> {

@Nullable
protected final WebClient webClient; // NOSONAR - final
protected final WebClient webClient;

protected WebFluxMessageHandlerSpec(URI uri, @Nullable WebClient webClient) {
this(new ValueExpression<>(uri), webClient);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* Provides WebFlux Components support for Spring Integration Java DSL.
*/
@org.springframework.lang.NonNullApi
@org.springframework.lang.NonNullFields
@org.jspecify.annotations.NullMarked
package org.springframework.integration.webflux.dsl;
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import org.jspecify.annotations.Nullable;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -458,7 +459,7 @@ private List<MediaType> getProducibleMediaTypes(ResolvableType elementType) {
.collect(Collectors.toList());
}

private MediaType selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier) {
private @Nullable MediaType selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier) {
List<MediaType> acceptableTypes = getAcceptableTypes(exchange);
List<MediaType> producibleTypes = getProducibleTypes(exchange, producibleTypesSupplier);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

import org.jspecify.annotations.Nullable;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
import org.springframework.context.ApplicationListener;
Expand Down Expand Up @@ -86,6 +88,7 @@
public class WebFluxIntegrationRequestMappingHandlerMapping extends RequestMappingHandlerMapping
implements ApplicationListener<ContextRefreshedEvent>, DestructionAwareBeanPostProcessor {

@SuppressWarnings("NullAway") // Reflection
private static final Method HANDLER_METHOD =
ReflectionUtils.findMethod(WebHandler.class, "handle", ServerWebExchange.class);

Expand All @@ -103,7 +106,10 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) thro
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
if (isHandler(bean.getClass())) {
unregisterMapping(getMappingForEndpoint((WebFluxInboundEndpoint) bean));
RequestMappingInfo mapping = getMappingForEndpoint((WebFluxInboundEndpoint) bean);
if (mapping != null) {
unregisterMapping(mapping);
}
}
}

Expand All @@ -118,13 +124,14 @@ protected boolean isHandler(Class<?> beanType) {
}

@Override
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected void detectHandlerMethods(Object handler) {
if (handler instanceof String string) {
handler = getApplicationContext().getBean(string); // NOSONAR never null
handler = getApplicationContext().getBean(string);
}
RequestMappingInfo mapping = getMappingForEndpoint((WebFluxInboundEndpoint) handler);
if (mapping != null) {
registerMapping(mapping, handler, HANDLER_METHOD); // NOSONAR never null
registerMapping(mapping, handler, HANDLER_METHOD);
}
}

Expand All @@ -134,7 +141,7 @@ protected void detectHandlerMethods(Object handler) {
* {@link org.springframework.integration.http.inbound.RequestMapping}.
* @see RequestMappingHandlerMapping#getMappingForMethod
*/
private RequestMappingInfo getMappingForEndpoint(WebFluxInboundEndpoint endpoint) {
private @Nullable RequestMappingInfo getMappingForEndpoint(WebFluxInboundEndpoint endpoint) {
org.springframework.web.bind.annotation.RequestMapping requestMappingAnnotation =
HttpContextUtils.convertRequestMappingToAnnotation(endpoint.getRequestMapping());
if (requestMappingAnnotation != null) {
Expand All @@ -146,7 +153,7 @@ private RequestMappingInfo getMappingForEndpoint(WebFluxInboundEndpoint endpoint
}

@Override
protected CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mappingInfo) {
protected @Nullable CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mappingInfo) {
CrossOrigin crossOrigin = ((BaseHttpInboundEndpoint) handler).getCrossOrigin();
if (crossOrigin != null) {
return buildCorsConfiguration(crossOrigin, mappingInfo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting inbound endpoints.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.webflux.inbound;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes to support WebFlux endpoints.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.webflux.support;