Refactor RSocket handler selection

1. Consolidate config options for handler detection in the base class
AbstractMethodMessageHandler with sub-classes like RSocketMessageHandler
now only setting the handler predicate by default (e.g. @Controller).

2. Remove autoDetection flag in favor of just having the mutually
exclusive handler Predicate<Object> vs manually registered List<Object>.
Or if both are desired for some reason, then manually register first,
and set the predicate second.
This commit is contained in:
Rossen Stoyanchev
2019-06-20 12:09:51 +01:00
parent 7d68a65dc0
commit 772087fe18
3 changed files with 52 additions and 77 deletions

View File

@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import org.junit.Test;
import org.reactivestreams.Publisher;
@@ -203,6 +202,10 @@ public class MethodMessageHandlerTests {
private PathMatcher pathMatcher = new AntPathMatcher();
public TestMethodMessageHandler() {
setHandlerPredicate(handlerType -> handlerType.getName().endsWith("Controller"));
}
@Override
protected List<? extends HandlerMethodArgumentResolver> initArgumentResolvers() {
return Collections.emptyList();
@@ -213,11 +216,6 @@ public class MethodMessageHandlerTests {
return Collections.singletonList(this.returnValueHandler);
}
@Override
protected Predicate<Class<?>> initHandlerPredicate() {
return handlerType -> handlerType.getName().endsWith("Controller");
}
@Nullable
public Object getLastReturnValue() {
return this.returnValueHandler.getLastReturnValue();