RouterFunctionMapping provides getter for RouterFunction
Issue: SPR-15991
This commit is contained in:
@@ -70,6 +70,18 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the configured {@link RouterFunction}.
|
||||
* <p><strong>Note:</strong> When router functions are detected from the
|
||||
* ApplicationContext, this method may return {@code null} if invoked
|
||||
* prior to {@link #afterPropertiesSet()}.
|
||||
* @return the router function or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
public RouterFunction<?> getRouterFunction() {
|
||||
return this.routerFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure HTTP message readers to de-serialize the request body with.
|
||||
* <p>By default this is set to the {@link ServerCodecConfigurer}'s defaults.
|
||||
|
||||
@@ -17,18 +17,14 @@ package org.springframework.web.reactive;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.MockSettings;
|
||||
import org.mockito.Mockito;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.codec.CharSequenceEncoder;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
|
||||
@@ -43,7 +39,7 @@ import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.withSettings;
|
||||
|
||||
/**
|
||||
*
|
||||
* Unit tests for {@link DispatcherHandler}.
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
public class DispatcherHandlerTests {
|
||||
|
||||
@@ -774,13 +774,14 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
* Return the configured {@link HandlerMapping} beans that were detected by
|
||||
* type in the {@link WebApplicationContext} or initialized based on the
|
||||
* default set of strategies from {@literal DispatcherServlet.properties}.
|
||||
* @return immutable list with the configured mappings or an empty list
|
||||
* <p><strong>Note:</strong> This method may return {@code null} if invoked
|
||||
* prior to {@link #onRefresh(ApplicationContext)}.
|
||||
* @return immutable list with the configured mappings or {@code null}
|
||||
* @since 5.0
|
||||
*/
|
||||
@Nullable
|
||||
public List<HandlerMapping> getHandlerMappings() {
|
||||
return this.handlerMappings != null ?
|
||||
Collections.unmodifiableList(this.handlerMappings) :
|
||||
Collections.emptyList();
|
||||
return this.handlerMappings != null ? Collections.unmodifiableList(this.handlerMappings) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user