RouterFunctionMapping provides getter for RouterFunction

Issue: SPR-15991
This commit is contained in:
Rossen Stoyanchev
2017-09-22 15:15:41 -04:00
parent 31619b3ffb
commit 816a58fcf9
3 changed files with 18 additions and 9 deletions

View File

@@ -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.

View File

@@ -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 {