Removed auto-fluxing Supplier result when Supplier is not reactive
This commit is contained in:
@@ -433,7 +433,7 @@ public class BeanFactoryAwareFunctionRegistry
|
||||
* This is ONLY relevant for web, so consider exposing some property or may be
|
||||
* the fact that this is a rare case (Supplier) leave it temporarily as is.
|
||||
*/
|
||||
return Flux.just(result);
|
||||
// return Flux.just(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -53,9 +53,9 @@ public abstract class SpringFunctionAppConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Supplier<Flux<String>> function = this.catalog.lookup(Supplier.class,
|
||||
Supplier<String> function = this.catalog.lookup(Supplier.class,
|
||||
"function0");
|
||||
assertThat(function.get().blockFirst()).isEqualTo("one");
|
||||
assertThat(function.get()).isEqualTo("one");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,9 +66,9 @@ public abstract class SpringFunctionAppConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Supplier<Flux<Integer>> function = this.catalog.lookup(Supplier.class,
|
||||
Supplier<Integer> function = this.catalog.lookup(Supplier.class,
|
||||
"function0|function1");
|
||||
assertThat(function.get().blockFirst()).isEqualTo(3);
|
||||
assertThat(function.get()).isEqualTo(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ public abstract class SpringFunctionAppExplodedConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Supplier<Flux<String>> function = this.catalog.lookup(Supplier.class,
|
||||
Supplier<String> function = this.catalog.lookup(Supplier.class,
|
||||
"function0");
|
||||
assertThat(function.get().blockFirst()).isEqualTo("one");
|
||||
assertThat(function.get()).isEqualTo("one");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -67,9 +67,9 @@ public abstract class SpringFunctionAppExplodedConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Supplier<Flux<Integer>> function = this.catalog.lookup(Supplier.class,
|
||||
Supplier<Integer> function = this.catalog.lookup(Supplier.class,
|
||||
"function0|function1");
|
||||
assertThat(function.get().blockFirst()).isEqualTo(3);
|
||||
assertThat(function.get()).isEqualTo(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -112,12 +112,14 @@ public class RequestProcessor {
|
||||
return new FunctionWrapper(function, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Mono<ResponseEntity<?>> get(FunctionWrapper wrapper) {
|
||||
if (wrapper.function() != null) {
|
||||
return response(wrapper, wrapper.function(), value(wrapper), true, true);
|
||||
}
|
||||
else {
|
||||
return response(wrapper, wrapper.supplier(), wrapper.supplier().get(), null,
|
||||
Object result = wrapper.supplier().get();
|
||||
return response(wrapper, wrapper.supplier(), result instanceof Publisher ? (Publisher) result : Flux.just(result), null,
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user